-
Notifications
You must be signed in to change notification settings - Fork 362
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
React: getTokenSilently() on page load inside useEffect() throws undefined error. #58
Comments
This SDK doesn't assume anything on how you're going to set this up in your framework of choice. If you need guidance with react, we have an amazing QuickStart here: https://auth0.com/docs/quickstart/spa/react/01-login |
You should not be recommending people use this with react if such a simple task can not be accomplished. |
I'm not saying it can't be done. It can, and do that in our QuickStart (https://auth0.com/docs/quickstart/spa/react/01-login). We even have an amazing wrapper that makes it super simple to integrate this library with your react app: https://auth0.com/docs/quickstart/spa/react/01-login#install-the-auth0-react-wrapper |
I have been reading through your tutorial routinely for the past 4 days. It does not say how to fetch a token in useEffect. Also, you should mention on your "Database Action Scripts" that if you have an error in your last script, and you execute your first script, it will throw error from last one. |
@wrightwriter If you want to use it inside a
|
Oh thank you, that was it. I guess I should have read the code for |
I know this is an old thread, but as I'm learning about Auth0 with React, I commonly see this pattern of passing I'm trying to understand why this is needed. From the React docs this argument should only take values that change: https://reactjs.org/docs/hooks-reference.html#conditionally-firing-an-effect Here's another example where the Auth0 team is suggesting passing the https://github.com/auth0/auth0-react#call-an-api Can someone explain? |
The error is
Works fine after the page is loaded.
Is this intended?
If I'd like to put the token in my redux storage, I'd have to use componentDidMount which is getting depricated by the React team.
The text was updated successfully, but these errors were encountered: