Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Users getting signed out #17

Open
crspybits opened this issue Jun 17, 2021 · 2 comments
Open

Users getting signed out #17

crspybits opened this issue Jun 17, 2021 · 2 comments

Comments

@crspybits
Copy link
Member

crspybits commented Jun 17, 2021

I've been getting reports of users being signed out when the app launches. This shouldn't happen.

From error logs and from code tracing, the sequence seems to be:

  1. The app launches.
  2. The appLaunchSetup(userSignedIn for the credentials (e.g., iOSGoogle) gets called.
  3. That credentials method calls the GenericSignInDelegate method signInCompleted.
  4. That call leads to a call to iOSBasics internal method completeSignInProcess
  5. That method calls api.checkCreds

If it has been a while since the app was last launched the sign in credentials may have expired.
This leads to the api.checkCreds call to receive an unauthorized response from the server, and the user is then signed out.

While I do do a refresh credentials when the app starts, that's insufficient. At best there is a race condition between that credentials refresh and the above api.checkCreds.

@crspybits
Copy link
Member Author

It seems like what is called for here is to get rid of the periodic credentials refresh that I've been doing, and only if we get an unauthorized response from our server, to then do a credentials refresh. IIRC this is what I was doing on Neebla v1. This is not a particularly simple fix.

@crspybits
Copy link
Member Author

I'm going to keep the periodic refresh also, but change it to not do the refresh when the app launches. The new iOSBasics credentials refresh in CredentialsRefresh will take care of the initial refresh for credential when the app launches. The other, periodic, refreshes will deal with other network requests-- which are done using a background URLSession and not amenable to the strategy used by CredentialsRefresh. I.e., we can't easily restart these requests on a failure due to stale credentials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant