Skip to content

feat(oauth): add support for additional scope in oauth flow #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

daliboru
Copy link
Contributor

@daliboru daliboru commented Aug 13, 2025

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 and expires_in. They are stored in the Account collection along with the access_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 the signin method of the AuthClient class. The scope is passed via oauth_scope to the endpoint and eventually to the OAuthHandlers handler.

Instructions on how to test the changes.

Add string to signin method

const { oauth } = authClient.signin(
    'https://www.googleapis.com/auth/drive.readonly',
  )

and try accessing Google Drive data by passing accessToken (a field on Account) to the appropriate place

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
add support for refresh tokens and token expiration in oauth authentication
update account info interface and collection schema accordingly
The variable name was misspelled as 'isVerifed' in two places. This commit fixes the typo to ensure consistent naming and prevent potential confusion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant