-
Notifications
You must be signed in to change notification settings - Fork 213
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
[SDK-3591] New Hook API supporting login and logout #500
Conversation
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.
lgtm, couple of little things
Co-authored-by: Adam Mcgrath <adam.mcgrath@auth0.com>
@@ -0,0 +1,32 @@ | |||
export const idTokenNonProfileClaims = new Set([ |
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 there any source we used to get these? Probably we should add the source as a comment here for future reference?
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.
I'm using the same list as defined internally in SPA JS: https://github.com/auth0/auth0-spa-js/blob/master/src/jwt.ts#L6
Changes
This PR adds a new hook
useAuth0
(based on Auth0 React's hook of the same name) as an alternative to using the Auth0 class, useful for when using function components.Example:
Supports:
authorize
- log in using the ULPclearSession
- log outuser
- get the user profileisLoading
(not currently used but here for future development when the credentials manager is added)error
Notes:
Auth0
class was moved from theindex
file to a different file to fix an issue with cyclic importsreact@17
in dev dependenciesjest@28
Quickstart demo
Screen.Recording.2022-08-12.at.13.29.50.mov
Testing
Unit tests have been added, as well as the API being tested using the quickstart (branch with changes).
Checklist