-
Notifications
You must be signed in to change notification settings - Fork 270
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
Help users by more robustly handling an incorrect redirect_uri parameter #506
Comments
Thank you for reaching out and sorry for the issues you've experienced.
I have reached out to the corresponding team to get them updated, or at least call out is uses an older version. I do recommend looking at our own Gatsby sample instead: https://github.com/auth0/auth0-react/tree/master/examples/gatsby-app, which we (the SDK team) guarantee to keep updated.
Any parameter in authorizationParams is solely intended to send to Auth0 as is. Auth0 accepts all kinds of properties, some are first-class properties, others aren't. With v2, we have decided to stick to the casing used with Auth0, instead of changing cases in our own SDK. This makes it easier when following along Auth0 Server documentation such as here: https://auth0.com/docs/api/authentication#authorization-code-flow We have explicitly called out the change in casing for That said, let me have a conversation internally to see if we can improve the experience here.
We have no control over Auth0 Server and how it does its logging or return codes. I do encourage providing product feedback if you believe these should be improved/changed. |
Having had a conversation internally, we will try and patch it in such a way that when if (options.redirectUri) {
console.warn(
'Using redirectUri has been deprecated, please use `authorizationParams.redirect_uri` instead as `redirectUri` will be no longer supported in a future version'
);
options.authorizationParams.redirect_uri = options.redirectUri;
}
if (options?.authorizationParams?.redirectUri) {
console.warn(
'Using authorizationParams.redirectUri has been deprecated, please use `authorizationParams.redirect_uri` instead as `authorizationParams.redirectUri` will be removed in a future version'
);
options.authorizationParams.redirect_uri = options.authorizationParams.redirectUri;
} |
Closing as we merged the PR, will see to cut a release soon. |
Describe the problem you'd like to have solved
I've just spent a frustrating 2 hours trying to get started (failing to log in correctly), because:
authorizationParams
)redirect_uri
parameter in the authorizationParams object needs to be snake cased (???!!!)Unable to issue redirect for OAuth 2.0 transaction
...invalid redirect_uri, check 'authorizationParams' and your 'callback_urls' setting
)UntrustedIP
in itDescribe the ideal solution
When breaking backward compatibility, it's generally helpful to give users a warning or indication that they might have fallen foul of it.
When writing in Javascript, accepting camelCased parameters might be sensible because its totally instinctive for JS developers to do that... so if typing out from your quickstart, instead of copy/pasting, it's a natural error.
I'd recommend (from my own experience, and those of this person and this person) to:
redirectUri
is added to theauthorizationParams
object, possibly with a warning or simply converted under the hood.redirect_uri
is missing, or appears to be passed incorrectly (since it's a required parameter??)Bad Request
(400) error code instead of aServer Error
(500) error code, to indicate that the problem is on my side, not internal to Auth0.More details
Here's an example of a log that I was trying to find the problems from. You'll see the "details" field has absolutely nothing to do with why the error arose, but does have a lot of other stuff that threw me way off the scent:
The text was updated successfully, but these errors were encountered: