Yes, calling window.location.reload()
should be sufficient in your case to restart the login flow. When the page reloads, Auth0 will handle the authentication process again and generate a new authentication transaction state.
Auth0 is designed to handle these scenarios seamlessly. When the page is reloaded, Auth0 will recognize that the authentication transaction has expired and initiate a new login flow. The new login flow will generate new values for the URL query parameters, including the state parameter.
By using window.location.reload()
, you ensure that the user is redirected back to the appropriate initiate_login_url
for their specific app/client. This eliminates the need for branching logic to determine the client_id and redirect accordingly.
Overall, this approach should work well and provide a better user experience by warning users and giving them the option to restart the login flow when the session has expired.