Skip to content

Commit 284b24f

Browse files
gyaneshgouraw-oktaguabuarpit-jn
authored
Refactor connectAccountWithRedirect to Use Top-Level Scopes and Upgrade Auth0 SPA JS to v2.9.0 (#933)
## 📝 Pull Request Description Completes this PR - #930 ### 🔄 Changes - Updated Auth0 SPA JS dependency from version 2.7.0 to 2.9.0. - Refactored the connectAccountWithRedirect API to use a dedicated scopes parameter instead of nesting it within authorization_params. - Updated documentation examples to reflect the new API structure for connecting third-party accounts. ### 🧪 Testing - Verified unit test ### 💥 Impact - Developers will have a cleaner API for specifying scopes when connecting third-party accounts. - The update improves consistency with other Auth0 SDK methods that use a top-level scopes parameter. - No breaking changes expected as this appears to be an API enhancement. ### 📋 Checklist - [ ] Code follows the project's coding standards - [ ] Tests have been added/updated - [ ] Documentation has been updated - [ ] All tests are passing --------- Co-authored-by: guabu <[email protected]> Co-authored-by: Arpit Jain <[email protected]>
1 parent 664248f commit 284b24f

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

EXAMPLES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,9 +658,9 @@ const ConnectAccount = () => {
658658
const { connectAccountWithRedirect } = useAuth0();
659659
return <button onClick={() => connectAccountWithRedirect({
660660
connection: '<CONNECTION eg, google-apps-connection>',
661-
access_type: 'offline', // You must also request a refresh token from the third party Identity Provider for it to be stored in Token Vault.
661+
scopes: ['<SCOPE eg https://www.googleapis.com/auth/calendar.acls.readonly>'],
662662
authorization_params: {
663-
scope: '<SCOPE eg https://www.googleapis.com/auth/calendar.acls.readonly>'
663+
// additional authorization params to forward to the authorization server
664664
}
665665
})}>Connect Google Calendar</button>;
666666
};

package-lock.json

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,6 @@
9595
"react-dom": "^16.11.0 || ^17 || ^18 || ^19"
9696
},
9797
"dependencies": {
98-
"@auth0/auth0-spa-js": "^2.7.0"
98+
"@auth0/auth0-spa-js": "^2.9.0"
9999
}
100100
}

src/auth0-context.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ export interface Auth0ContextInterface<TUser extends User = User>
126126
* ```js
127127
* await connectAccountWithRedirect({
128128
* connection: 'google-oauth2',
129-
* authorizationParams: {
130-
* access_type: 'offline',
131-
* scope: 'openid profile email https://www.googleapis.com/auth/drive.readonly',
129+
* scopes: ['openid', 'profile', 'email', 'https://www.googleapis.com/auth/drive.readonly'],
130+
* authorization_params: {
131+
* // additional authorization params to forward to the authorization server
132132
* }
133133
* });
134134
* ```

0 commit comments

Comments
 (0)