Invalid access token leads to "Connectivity to the server has been lost" with no way to gracefully recover - need to manually logout and re-login
See original GitHub issueSteps to reproduce
- Lost connection to server, probably because of a internet connection issue from Server side.
- Checked that the Server is back up.
- Tried to send messages etc., but Client still insists that the Server is not available.
- Searched in the server logs, found error
SynapseError: 401 - Invalid Authorization header.
- Searched the internet and found this: https://github.com/vector-im/element-web/issues/14529#issuecomment-879849922
- After Logout and Re-login everything was working normal, just as suggested by the user.
Outcome
What did you expect?
Client should be able to reconnect to a server by itself without a logout being necessary. Client should at least show a useful error message.
What happened instead?
Client insisted that a connection is not possible without any explanation.
Operating system
Manjaro Linux
Application version
Element v1.11.2
By the way, this problem also occurs with the Android App.
How did you install the app?
Manjaro Repos
Homeserver
Synapse 1.64.0
Will you send logs?
No
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
What Are Refresh Tokens and How to Use Them Securely
The Auth0 Authorization Server recognizes that someone is reusing Refresh Token 1 and immediately invalidates the refresh token family, ...
Read more >Invalidating JSON Web Tokens - Stack Overflow
A common approach for invalidating tokens when a user changes their password is to sign the token with a hash of their password....
Read more >Fix list for IBM WebSphere Application Server V8.5
The following is a complete listing of fixes for V8.5 with the most recent fix at the top. Content. Back to all versions ......
Read more >Fixes, Limitations, and Known Issues - ForgeRock Backstage
OPENAM-17673: Nodes within a Page node do not have access to secure state ... OPENAM-17349: OIDC Refresh token - Ops token is deleted...
Read more >Meta for Developers | How-To: Handle expired access tokens
One of the most frequently asked for “How-To” requests from developers is how to handle invalid access tokens. Access tokens for users can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It sounds like your access token is no longer valid so you can’t authenticate and communicate with the homeserver anymore. Your token could have been invalidated in a number of different ways. Is there anything special about your homeserver setup (SAML, SSO, CAS)?
As the other person suggested, when the client sees a
401 - Invalid Authorization header
response from the homeserver, it should ask you to sign in again. Maybe this means completely signing you out but it seems a bit more friendly if we just update theRoomStatusBar
to take this situation into account and explain that you need to sign in again since your token is no longer valid.It seems like soft-logout is a concept in the app so we could probably adapt some of that. Or maybe we’re just missing a case to trigger that.
If it’s possible use the refresh token to get a new access token, we should also be doing that. I see code for
refreshToken
but I don’t see any usage of this. So this is also something we might need to look at and improve.No. This problem occured with multiple accounts, also with other users on my server.