Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

IPC-based refresh tokens #7803

Closed
wants to merge 4 commits into from
Closed

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Feb 15, 2022

Alternative to #7802 using IPC instead of IndexedDB for cross-tab handling.

This is significantly more involved, and incomplete. The bulk of the description is in 9cb3e27


This PR currently has no changelog labels, so will not be included in changelogs.

Add one of: T-Deprecation, T-Enhancement, T-Defect, T-Task to indicate what type of change this is plus X-Breaking-Change if it's a breaking change.

@turt2live
Copy link
Member Author

Closing as this isn't intended to land - just opening for posterity.

@turt2live turt2live closed this Feb 15, 2022
@turt2live turt2live deleted the travis/refresh-tokens-ipc branch February 15, 2022 03:34
turt2live added a commit that referenced this pull request Feb 15, 2022
MSC: matrix-org/matrix-spec-proposals#2918
Fixes element-hq/element-web#18698
Fixes element-hq/element-web#20648
**Requires matrix-org/matrix-js-sdk#2178

**Note**: There's a lot of logging in this PR. That is intentional to ensure that if/when something goes wrong we can chase the exact code path. It does not log any tokens - just where the code is going. Overall, it should be fairly low volume spam (and can be relaxed at a later date).

----

This approach uses indexeddb (through a mutex library) to manage which tab actually triggers the refresh, preventing issues where multiple tabs try to update the token. If multiple tabs update the token then the server might consider the account hacked and hard logout all the tokens.

If for some reason the timer code gets it wrong, or the user has been offline for too long and the token can't be refreshed, they should be sent to a soft logout screen by the server. This will retain the user's encryption state - they simply need to reauthenticate to get an active access token again.

This additionally contains a change to fix soft logout not working, per the issue links above.

Of interest may be the IPC approach which was ultimately declined in favour of this change instead: #7803
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant