Closed stripethree closed 1 year ago
Thanks for the detailed report and the fix. I was able to reproduce it and fix it
Hi, I still have this exact same issue with 1.0.1...
please can you make a new release with the fix... it's in fact not in 1.0.1
When a session expires,
ra-auth-cognito
does not appear to correctly redirect a user to the Cognito hosted UI.In this state, this is what appears to happen, in chronological order:
getPermissions
is called in theauthProvider
userPool.getCurrentUser()
returns a valid useruser.getSession
returns an error: Cannot retrieve a new session. Please authenticate.getPermissions
returnsPromise.reject
with the errorcheckAuth
is called in theauthProvider
userPool.getCurrentUser()
returns a valid useruser.getSession
returns an error: Cannot retrieve a new session. Please authenticate.checkAuth
returnsPromise.reject
with the errorIf the
{loginPage}
attribute on<Admin>
is set toLogin
(from this library), the user is forwarded to theLogin
view. This is not useful since username/password is not enabled. There appears to be no way to return to the Cognito Hosted UI login page without manually updating the URL in the location bar. Clearing browser data, navigating back to the applications root URL, etc. all lead to this scenario.If the
{loginPage}
attribute on<Admin>
is set tofalse
, which makes sense given the information in #2, the screen is stuck on a loading view:Making the following change in
authProvider.ts
checkAuth
function resolves the issue in my testing:Changing this in
getPermissions
is not possible without larger changes, given where theredirectToOAuthIfNeeded
is currently defined.More information on the configuration of the application I am developing and how I am testing
Authentication flow session duration 3 minutes
Refresh token expiration 60 minutes
Access token expiration 5 minutes
ID token expiration 5 minutes