Skip to content

Add support for connected accounts#1422

Merged
gyaneshgouraw-okta merged 3 commits intomainfrom
connected-accounts
Oct 10, 2025
Merged

Add support for connected accounts#1422
gyaneshgouraw-okta merged 3 commits intomainfrom
connected-accounts

Conversation

@adamjmcgrath
Copy link
Copy Markdown
Contributor

@adamjmcgrath adamjmcgrath commented Sep 26, 2025

Changes

Add support for Connected Accounts to SPA JS:

  • Add a new connectAccountWithRedirect method that redirects the application to the /connect endpoint on the auth server (similar mechanics to the logging in with the /authorize endpoint)
  • Add subset of My Account API client to help with connect flow (provides /connect - similar to PAR and /complete similar to token exchange)
  • Add a new playground to test Connected Accounts

References

https://auth0team.atlassian.net/browse/AGAI-156

Testing

Manual testing steps and demo video are in ESD-52259

  • This change adds unit test coverage
  • This change adds integration test coverage
    (integration tests are not possible since oidc-provider does not support the proprietary Auth0 connect flow)
  • This change has been tested on the latest version of the platform/language

Checklist

Comment thread src/Auth0Client.ts Fixed
Comment thread src/Auth0Client.ts Fixed
@adamjmcgrath adamjmcgrath force-pushed the connected-accounts branch 4 times, most recently from 3ffdffd to 1b1981b Compare September 30, 2025 09:53
Comment thread src/Auth0Client.ts Fixed
@adamjmcgrath adamjmcgrath force-pushed the connected-accounts branch 8 times, most recently from d6be788 to 9ee3378 Compare October 2, 2025 15:53
@adamjmcgrath adamjmcgrath marked this pull request as ready for review October 2, 2025 17:38
@adamjmcgrath adamjmcgrath requested a review from a team as a code owner October 2, 2025 17:38
@adamjmcgrath adamjmcgrath force-pushed the connected-accounts branch 2 times, most recently from 8f02b6b to 58ba314 Compare October 3, 2025 13:51
Comment thread src/Auth0Client.ts
}),
getDpopNonce: () => this.getDpopNonce(config.dpopNonceId),
setDpopNonce: nonce => this.setDpopNonce(nonce),
setDpopNonce: nonce => this.setDpopNonce(nonce, config.dpopNonceId),
Copy link
Copy Markdown
Contributor Author

@adamjmcgrath adamjmcgrath Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamjmcgrath adamjmcgrath force-pushed the connected-accounts branch 2 times, most recently from 4248327 to a69e3f0 Compare October 6, 2025 11:34
@adamjmcgrath
Copy link
Copy Markdown
Contributor Author

@claude

@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 7, 2025

Claude finished @adamjmcgrath's task —— View job


Review Complete ✅

I've reviewed the connected accounts PR and identified several security and code quality issues that need attention.

Review Progress

  • Read diff to understand changes
  • Skip AGENTS.md (file not found)
  • Create pending review
  • Analyze core implementation files
  • Check security and error handling
  • Submit review with findings

Key Issues Found

  • Security: User-controlled bypass of CSRF state validation (Auth0Client.ts:653)
  • Security: Information disclosure in error messages (MyAccountApiClient.ts:118)
  • Security: Open redirect vulnerability with window.location.origin fallback (Auth0Client.ts:1536)
  • Security: Unvalidated connect_uri from API response (Auth0Client.ts:1570)
  • Code Quality: Type safety issue with string literal instead of enum (Auth0Client.ts:1566)

The PR has good test coverage and documentation, but these security concerns should be addressed before merging.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall Assessment

Issues need to be addressed

This PR introduces connected accounts functionality with comprehensive test coverage and clear documentation. However, several security vulnerabilities and code quality issues require attention:

Security Concerns

  • State validation bypass: The CSRF protection can potentially be circumvented by user-controlled input
  • Information disclosure: Raw API response bodies are exposed in error messages
  • Open redirect risk: Fallback to window.location.origin for redirect URI
  • URL validation: Direct use of API-provided connect_uri without domain validation

Recommendations

  1. Address the state validation security issue identified by GitHub Advanced Security
  2. Sanitize error messages to prevent information leakage
  3. Implement proper redirect URI validation and avoid dynamic origins
  4. Add domain validation for connect URIs
  5. Use enum values instead of string literals for type safety

The implementation follows good patterns with PKCE, proper error handling, and comprehensive testing, but the security issues should be resolved before merging.

Comment thread src/Auth0Client.ts
Comment thread src/MyAccountApiClient.ts
Comment thread src/Auth0Client.ts
Comment thread src/Auth0Client.ts Outdated
Comment thread src/global.ts
/**
* The type of response, for login it will be `code`
*/
response_type: ResponseType.Code;
Copy link
Copy Markdown
Contributor

@gyaneshgouraw-okta gyaneshgouraw-okta Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this response_type field a required field for existing flows also ?
Will making it required may cascade into breaking typescript change for existing users ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the return type of a function, so I wouldn't have thought adding a property could be a breaking change. It's not caused any issues in auth0-react.

But I might be wrong, let me know if you can demonstrate how it would break upstream code and I can change it to fix.

I've tried here https://www.typescriptlang.org/play/?ts=4.9.5#code/KYOwrgtgBASsDOAVAngB2FA3gKClAwgPYAmGAvFAOQDGJwlANLgYSCMNQC5GlQU2t2XAPq1SlbAF9s2AJYhOwAE4AzAIbUMAeQA2xOMVlKOnADKEA5vLjwwOzgB5EAQVSoAypzWK+UNSGQAPixmNTdPb2AAfgAuKBdwr0UAbikZeUVVDQwAOWAAdwMjE3MrEBs7RwSPJPI-AOCcPDCayNj411aU5mN4VFZ4YGFONGA4mxR0ADoeYFTpbBH0KHZ8gFlgTgALEl8ACgBKPmC8wuBDYy5S6wRK1OxaEHhOKBVCQjjdfXPiq8sb2z2fZ7Q7HKB7TBQXr9J5DJZjKhiehQSQHI5qeArAobbYkA6HVJAA and it seems to work ok

Image

@frederikprijck ☝️ you're better at this stuff than me 😁 do you think this might be a breaking change?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The simulator looks fine, i will try to check in an example app setup also.

@gyaneshgouraw-okta
Copy link
Copy Markdown
Contributor

Overall the PR looks good to me, Thanks for getting it up.

@gyaneshgouraw-okta gyaneshgouraw-okta merged commit 55792c8 into main Oct 10, 2025
20 checks passed
@gyaneshgouraw-okta gyaneshgouraw-okta deleted the connected-accounts branch October 10, 2025 11:10
@adamjmcgrath adamjmcgrath mentioned this pull request Oct 10, 2025
gyaneshgouraw-okta pushed a commit that referenced this pull request Oct 13, 2025
**Added**
- Add support for connected accounts
[\#1422](#1422)
([adamjmcgrath](https://github.com/adamjmcgrath))

**Fixed**
- Fetcher should set DPoP nonce with nonce id
[\#1431](#1431)
([adamjmcgrath](https://github.com/adamjmcgrath))
- fix: do not mark setAuthorizationHeader as async
[\#1428](#1428)
([frederikprijck](https://github.com/frederikprijck))
adamjmcgrath added a commit to auth0/auth0-react that referenced this pull request Oct 15, 2025
### Changes

Add support for Connected Accounts to SPA JS:

- Bump SPA-JS to include auth0/auth0-spa-js#1422
- Add a new `connectAccountWithRedirect` method that redirects the
application to the `/connect` endpoint on the auth server (similar
mechanics to the logging in with the `/authorize` endpoint)
- Update the playground to enabled testing Connected Accounts
<img width="50%" height="50%" alt="image"
src="https://github.com/user-attachments/assets/7aecbc87-5f1b-47ee-a868-0d7c05a3ba56"
/>


### References

https://auth0team.atlassian.net/browse/AGAI-157

### Testing

Manual testing steps and demo video are in ESD-52475

- [x] This change adds unit test coverage
- [ ] This change adds integration test coverage 
(integration tests are not possible since oidc-provider does not support
the proprietary Auth0 connect flow)
- [x] This change has been tested on the latest version of the
platform/language

### Checklist

- [x] I have read the [Auth0 general contribution
guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)
- [x] I have read the [Auth0 Code of
Conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)
- [x] All code quality tools/guidelines have been run/followed
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.

3 participants