Migrating to AccountsJS JWT from Meteor Login Token #1218
-
We have an Apollo GraphQL project that we are migrating away from MeteorJS. We have implemented custom |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Fumbled my way through figuring this out: Our existing UserSignIn mutation now returns LoginResult obtained from calling AccountsServer.loginWithService() in the UserSignIn resolver method, which we then add to localstorage using AccountsClient.setTokens() in the Apollo Client UserSignIn mutation subscription handler, allowing us to return the token in the headers using ApolloLink and in the Subscriptions WebSocket connection parameters using AccountsClient.getTokens(). Our UserSignOut mutation then calls AccountsServer.logout() with the Apollo Client UserSignOut mutation subscription handler calling AccountsClient.clearTokens(). |
Beta Was this translation helpful? Give feedback.
Fumbled my way through figuring this out:
Our existing UserSignIn mutation now returns LoginResult obtained from calling AccountsServer.loginWithService() in the UserSignIn resolver method, which we then add to localstorage using AccountsClient.setTokens() in the Apollo Client UserSignIn mutation subscription handler, allowing us to return the token in the headers using ApolloLink and in the Subscriptions WebSocket connection parameters using AccountsClient.getTokens(). Our UserSignOut mutation then calls AccountsServer.logout() with the Apollo Client UserSignOut mutation subscription handler calling AccountsClient.clearTokens().