-
Notifications
You must be signed in to change notification settings - Fork 428
feat: add support for backchannel authentication #2261
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
base: main
Are you sure you want to change the base?
Conversation
Would it make more sense to use auth0-auth-js for CIBA now if that's what the sdk is going to end up using? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2261 +/- ##
==========================================
+ Coverage 85.39% 85.61% +0.21%
==========================================
Files 26 26
Lines 2471 2606 +135
Branches 462 477 +15
==========================================
+ Hits 2110 2231 +121
- Misses 355 369 +14
Partials 6 6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
return [ | ||
new BackchannelAuthenticationError({ | ||
cause: new OAuth2Error({ | ||
code: e.error, | ||
message: e.error_description | ||
}) | ||
}), | ||
null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errors that come from Auth0 in the redirect_uri callback may contain reflected user input via the OpenID Connect error and error_description query parameter. You should not render the error message, or error and error_description properties without properly escaping them first.
See
nextjs-auth0/src/errors/index.ts
Line 7 in b685e5c
* You should **not** render the error `message`, or `error` and `error_description` properties without properly escaping them first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is passing e.error_description
safe here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we think that exporting openid-client polling configuration can be useful here instead of hardcoding the default config?
https://github.com/panva/openid-client/blob/main/docs/interfaces/BackchannelAuthenticationGrantPollOptions.md
* Using Client-Initiated Backchannel Authentication requires the feature to be enabled in the Auth0 dashboard. | ||
* @see https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-initiated-backchannel-authentication-flow | ||
*/ | ||
async getTokenByBackchannelAuth(options: BackchannelAuthenticationOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Authenticates using Client-Initiated Backchannel Authentication and returns the token set and optionally the ID token claims and authorization details.
Should this be named as authenticateWithBackchannel
instead?
📋 Changes
Adds support for Client-Initiated Backchannel Authentication. A new method
backchannelAuthentication
is exposed on the client that enables developers to initiate a backchannel authentication request and poll the token endpoint until it's complete.The
openid-client
was added to handle the polling and retry logic without having to re-implement it ourselves usingoauth4webapi
and to start moving the implementation closer to that ofauth0-auth-js
.🎯 Testing
backchannelAuthentication
method from a server route/action