accounts icon indicating copy to clipboard operation
accounts copied to clipboard

accounts client link issues

Open sakulstra opened this issue 4 years ago • 0 comments

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

  1. login via apollo-client
  2. drop database
  3. try to logout
Uncaught (in promise) Error: GraphQL error: Tokens are not valid
  1. 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:

  1. one could just not throw in https://github.com/accounts-js/accounts/blob/master/packages/graphql-api/src/modules/accounts/resolvers/mutation.ts#L49
  2. 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

sakulstra avatar Mar 28 '20 11:03 sakulstra