General questions (disconnect callback + login redirect)?

Hi from Belgium everyone ! I wave a React website using “@auth0/auth0-react”: “^1.9.0”, and both works fine and smoothly. My two left concerns are the following (long questions, but surely with easy answers):

  1. is there a way for React to be aware of auto disconnection from Auth0 (callback, webhook)? I’d like to warn the user reading a long text that he has been automatically disconnected, but to succeed that I have to catch the corresponding event, if any.

  2. I would like permit my users to connect from any page within my website (Connect button available on every “unregistered area” pages) AND stay on that page after login. The problem is that, on Auth0 dashboard, I don’t see any way of wildcarding “Allowed Callback URLs”, and as my website is dynamic, I am just not able to add all possibles callback URLs. Any hint on this? Or, at least, may I pass to Auth0 some data which will, in return, be sent back to my website? In that case, I would be able to manage the redirection myself.

Thank you very much for your help.

Aaaaand found an answer to my second question just after posting it :confused: Before that I tried with passing redirect_uri as a RedirectLoginOptions to loginWithRedirect, with no result (probably because of my permitted callback URLs statement above). But passing an { appState: { … } } will return that very appState to the <Auth0Provider> of the returned page, so I am able to redirect manually :slight_smile:

Hi @MamorukunBE

For your first question: there are two sessions, your App session and your Auth0 session. When you are doing an operation, if your app session times out you will then reconnect to Auth0, and if your Auth0 session is valid, you will return without asking for credentials.

So, there is not “disconnect” that happens.

Instead, your app should be aware of your app session timeouts, and use that to determine if you might need to connect to Auth0 in the middle of a long operation.

John

OK thank you, I’ll review my app in that direction then :slight_smile: