SyncServerII / Neebla

Private and Self-Owned Social Media
MIT License
1 stars 2 forks source link

If server restarts, you have to sign back into Neebla. #10

Closed crspybits closed 3 years ago

crspybits commented 3 years ago

If server restarts, you have to sign back into Neebla. I don’t see any reason why you’d have to. This seems like a server issue. I just did the following trials: I restarted the server and that required me to sign back in. Index requests to the server failed. I restarted the server and new Index requests continued to work. I restarted the server and new Index requests continued to work.

I wonder if the following is going on: On a first request to the server, when the server hasn’t cached any auth tokens, the auth token is cached, and no further checks are carried out with that auth token at the Kitura credentials level. Then, the server gets restarted. The client auth token expires The client auth token gets used to try to reauth the user at the kitura level. Because the client auth token has expired that reauth doesn’t work.

I suspect there may be two issues, both on the client side: When the app restarts, the credentials don’t get refreshed until 10 minutes have passed. So if the app was restarted and the server had been restarted, the user will have to sign in. When the app comes into the foreground, credentials don’t get refreshed. So, if the server had been restarted while the app was in the background, and the apps creds had expired, the user will have to sign back in.

Fix: Added iOSSignIn calls to try to fix credentials refresh issue, when server is restarted. Now, credentials will refresh when (a) app comes into foreground, and (b) when app starts.