Thanks. Actually, changing the ‘navigate’ was our first solution. But it doesn’t work. The application gets hung on the callback page and/or the entire application just goes back to whatever you put in navigate. So if you put in navigate(‘/’), after someone logs in, they can only access the homepage and no other page. So this doesn’t provide a solution. If that’s the solution for the new SDK also, then I guess the SDK will have the same problem.
Honestly, there is nothing different in our app. We copied your code exactly, and it works, except for the fact that you can only access the /account/ page after or whatever page is in the navigate. And we are using the Gatsby Starter blog. We are not the only one with this problem as per the comments above, and your guide specifically mentions this issue as well, as a problem. So it’s got nothing to do with our app. You yourselves recognize the problem, but don’t provide a solution. I’m sure many people just gave up on using Auth0 with Gatsby, after experiencing the same issue.
However, I’m sure, our auth.js now is completely wrong, because we have no idea what the changes should be based on the suggestions provided, so yeah, our app is messed up now. Why can’t you just publish an updated auth.js guide with the code that allows people to navigate to any part of the site after logging in? Of what benefit is it to offer a solution with a built-in bug? It will just make most people completely give up on your service, because the code provided doesn’t work and the solution to the problem is not being provided in a format that allows it to be implemented.
It would be in the financial interest of your company, to just publish the code in the auth.js or the new SDK, as it should be written, not as some sort of puzzle to figure out. If it works in the Gatsby store, why can’t you just publish what their auth.js is? It’s not some proprietary code if they are just using what you used in your guide with a couple of line chages. What is the point of making this difficult to use?
Here is the code for our current auth.js based on the changes suggested above. Please let us know what it is wrong. Per the suggestion above we also changed navigate to navigate(“/”) instead of ‘/account/’. So now when a user logs in they get redirected to the homepage now for every single page, instead of the /account/. So it’s the same problem, just a different page. When a user logs in, they can only access one page on the entire website. What is the code so that they can navigate the entire website and not get redirected to one page?
Not sure if anyone else has ran into this issue before but Im having a weird issues surrounding how the callback page returns on mobil devices.
When I run my site locally in development/ production mode and deploy to a CDN the login works perfect but when I go to check it out on a mobil device’s chrome/ safari I keep getting stuck in the /callback page.
I feel like I have heard of this but can’t for the life of me remember what the answer was. @konrad.sopala do you have any idea why this may be? I think you’ve done more mobile dev than me.
It’s a really weird bug, everything works on desktop. Even on mobil it directs you to the auth0 page then bounces you back to the call back page but the callback page never sends you to the profile page. If it helps I’m opening the site on both safari and chrome on my iPhone.
So, we successfully deployed Auth0 and Gatsby on a production site. However, we ran into a frustrating bug. Basically, after as user logs in with Auth0, if the user then refreshes the page for whatever reason, a 404 Error appears, that the Auth0 authentication can’t be accessed. If you navigate the site without refreshing pages you are fine, but the minute you try to refresh the page, which happens quite often with users, the page is gone and there is a 404 error. Now I know this has to do with React Router somehow and how it processes the app, but the application demo with Auth0 and Gatsby uses React Router (@reach/router), so I’m wondering how we are supposed to fix this problem on a production site?
@ddsgadget are you using a connection/social provider like Google to login by chance? If you are you’ll need to register and create production keys with that provider. The Auth0 dev keys for those connections don’t work in production and won’t work with the silent auth. Click on the instructions for the right provider here for a tutorial on how to do it: Social Identity Providers
No, we are not using Google login. The only thing that changed is that we were using “passwordless” login, and it was working fine actually. Then we switched to Database authentication (as we needed additional functionality), and the app simply stopped working. So we switched back to “passwordless” and now we continue to have problems. After a user logs in, if they refresh the page, it shows a 400 error (Failed to load resource: the server responded with a status of 400 ). The resource that fails to load is the auth0 url (domain/authorize?client_id) etc. The strange thing is that if you never refresh the page, it navigates fine and you are logged in. But, if you refresh, then it just doesn’t load the auth0.
So we have run many more tests. The error we get on a page refresh is: **invalid_request** : The specified redirect_uri 'https://www.OURWEBSITE.com/callback' does not have a registered origin.
Obviously, ourwebsite.com is changed to our website. This is a strange error, because the callback works fine without a page refresh, so why would the callback not work on a page refresh?? Our settings are fine and we have the callback page, and when a user clicks on the website, the callback is called without any errors.
Just a quick update, we believe we have solved the problem, by dropping the trailing slash from our origin URL. So we had it as: http://www.ourwebsite.com/ - but when we change the origin URL to http://www.ourwebsite.com , without the ‘/’- it seems to work fine.