mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-09 20:27:44 +00:00
feat(socialLink): add support for custom scopes in social account linking (#2074)
* feat(socialLink): add support for custom scopes in social account linking - Updated documentation to include information on requesting specific scopes when linking social accounts. - Added a test case to verify that custom scopes are correctly passed to the authorization URL. - Modified the account linking endpoint to accept additional scopes as an optional parameter. * chore: lint * fix(account): update account linking logic and tests --------- Co-authored-by: Bereket Engida <bekacru@gmail.com>
This commit is contained in:
@@ -304,6 +304,16 @@ Users already signed in can manually link their account to additional social pro
|
||||
});
|
||||
```
|
||||
|
||||
You can also request specific scopes when linking a social account, which can be different from the scopes used during the initial authentication:
|
||||
|
||||
```ts
|
||||
await authClient.linkSocial({
|
||||
provider: "google",
|
||||
callbackURL: "/callback",
|
||||
scopes: ["https://www.googleapis.com/auth/drive.readonly"] // Request additional scopes
|
||||
});
|
||||
```
|
||||
|
||||
If you want your users to be able to link a social account with a different email address than the user, or if you want to use a provider that does not return email addresses, you will need to enable this in the account linking settings.
|
||||
```ts title="auth.ts"
|
||||
export const auth = betterAuth({
|
||||
|
||||
Reference in New Issue
Block a user