Skip to content
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

Merged
merged 5 commits into from
Feb 10, 2021

Conversation

THISS
Copy link
Contributor

@THISS THISS commented Jan 30, 2021

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 added

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not master

@THISS THISS requested a review from a team as a code owner January 30, 2021 03:27
src/auth0-provider.tsx Outdated Show resolved Hide resolved
src/auth0-provider.tsx Show resolved Hide resolved
@adamjmcgrath adamjmcgrath added the review:small Small review label Feb 4, 2021
@@ -228,6 +229,17 @@ const Auth0Provider = (opts: Auth0ProviderOptions): JSX.Element => {
})();
}, [client, onRedirectCallback, skipRedirectCallback]);

const buildAuthorizeUrl = useCallback(
(opts?: RedirectLoginOptions): Promise<string> =>
client.buildAuthorizeUrl(opts),
Copy link
Contributor

@adamjmcgrath adamjmcgrath Feb 10, 2021

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

Copy link
Contributor Author

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...

@adamjmcgrath adamjmcgrath merged commit 3a716ff into auth0:master Feb 10, 2021
@adamjmcgrath
Copy link
Contributor

Thanks @THISS!

@THISS THISS deleted the build-urls-from-auth0-spa-js branch February 10, 2021 18:21
@aaronadamsCA
Copy link

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 logout(). 🙌

@adamjmcgrath
Copy link
Contributor

adamjmcgrath commented Feb 16, 2021

Released in https://github.com/auth0/auth0-react/releases/tag/v1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review:small Small review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants