accounts
accounts copied to clipboard
accounts client link issues
Bug report
Accounts apollo client doesn't remove client-side token on logout error keeping it in an invalid state.
Describe the bug
In our dev environment we periodically prune the database pushing users that didn't logout before in an invalid state. The problem as I get it, is that client.logout()
throws when the session does not exist and therefore the client token in local storage/cookies are not removed.
To Reproduce
- login via apollo-client
- drop database
- try to logout
Uncaught (in promise) Error: GraphQL error: Tokens are not valid
- cookie/localStorage will still be set
Expected behavior
You should be able to get into a valid state without workarounds
System information
- Version of accounts-js: 0.0.24
Additional context
I already checked the source, but am not quite sure where to fix this issue:
- one could just not throw in https://github.com/accounts-js/accounts/blob/master/packages/graphql-api/src/modules/accounts/resolvers/mutation.ts#L49
- one could catch the error in https://github.com/accounts-js/accounts/blob/master/packages/client/src/accounts-client.ts#L193 & logout on this kind of error
I'd be happy to fix this, i'm just not sure yet where to look at