feat(oauth): add support for additional scope in oauth flow #145
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
short description
Add optional additionalScope parameter to oauth functions to allow requesting extra permissions store additional scope in cookie and pass it through authorization and callback flows
EDIT: I also needed to expose
refresh_token
andexpires_in
. They are stored in theAccount
collection along with theaccess_token
The purpose of the changes.
I want to be able to update the scope after the initial OAuth flow, e.g., a user wishes to grant access to their GDrive; additional scope needs to be added.
The problem being solved or the feature being added.
I decided to solve this by adding an optional variable (
additionalScope
) to thesignin
method of theAuthClient
class. The scope is passed viaoauth_scope
to the endpoint and eventually to theOAuthHandlers
handler.Instructions on how to test the changes.
Add string to
signin
methodand try accessing Google Drive data by passing
accessToken
(a field onAccount
) to the appropriate place