-
Notifications
You must be signed in to change notification settings - Fork 266
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
feat: added buildAuthorizeUrl and buildLogoutUrl from auth0-spa-js #190
feat: added buildAuthorizeUrl and buildLogoutUrl from auth0-spa-js #190
Conversation
src/auth0-provider.tsx
Outdated
@@ -228,6 +229,17 @@ const Auth0Provider = (opts: Auth0ProviderOptions): JSX.Element => { | |||
})(); | |||
}, [client, onRedirectCallback, skipRedirectCallback]); | |||
|
|||
const buildAuthorizeUrl = useCallback( | |||
(opts?: RedirectLoginOptions): Promise<string> => | |||
client.buildAuthorizeUrl(opts), |
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.
@THISS Annoyingly you still need to do client.buildAuthorizeUrl(toAuth0LoginRedirectOptions(opts))
Somewhere in between making spa js and auth0-react we changed the options from snake case to camel case
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.
sorry about that, I had checked how it is converted but forgot to add in the method that converts it...
Thanks @THISS! |
I was literally just opening a feature request to expose the logout URL, and I was growing increasingly confused why I could see this capability on GitHub, but not in my IDE. Imagine my surprise that it was added within the last 24 hours. Thanks for this! Putting it to use already in a Shopify app, which runs inside an iframe and therefore can't just call |
By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
Added in the buildAuthorizeUrl and buildLogoutUrl which were both in the https://github.com/auth0/auth0-spa-js repo. This helps with projects that need more management over the browser client eg. Ionic using capacitor requires a native "Browser" plugin to do redirects in app.
References
Related PRs from the spa-js repo: auth0/auth0-spa-js#280, auth0/auth0-spa-js#595
Testing
Added to the
auth-provider.test.tsx
unit tests a couple of noop tests for coverage that just make sure the call is passed through to the Auth0Client similar to a couple of other tests. I looked at cypress but it seems there is just a bare bones smoke test so didn't feel this needed the full treatment of getting the strings. Let me know if you would like them addedChecklist
master