I have multi app setup on same domain but different subdomains with single sign on.
I usually use loginWithRedirect when my pages require login or I simply do not use login (only signup pages).
Now I have a page in which you must or you do not must be logged in depending on “public” parameter from API and one app redirects to this new app to view that page.
I though “getAccessTokenSilently” would handle this case, but from it i get login Required error despite being logged in on my other subdomain. So at the moment I am handling it if it is not “public” I get 401 from API, call loginWithRedirect and reload page again. And if user visits public site he is not aware he is logged in.
Not the fan of this approach, I read there was “CheckSession” but with old auth0-spa.js So I am checking is there any alternative. The ideal flow would be very similar to loginWithRedirect, it would just skip the login screen.
!IsAuthenticated->someNewTryLoginWithRedirect->userOnIdentityProvider->proceed as loginWithRedirect.
!IsAuthenticated->someNewTryLoginWithRedirect->userNotOnIdentityProvider->return NotAuthenticated and that is it I can handle both cases perfectly without unnecessary failed api calls, reloading of the page and so on.
Any ideas?