amplify-js: NotAuthorizedException Invalid login token. Couldn't verify signed token
Describe the bug I’m using amplify-authenticator for Vue, and intermittently when I go to my app I will get a not authorized exception. Then I refresh (I don’t login again), and it works.
To Reproduce I’m not sure exactly how to reproduce this. I run into it about 3% of the time.
Expected behavior Authentication should not fail intermittently.
Code Snippet I’m not sure what code would be most relevant, but here is how I’m using the amplify-authenticator component:
<amplify-authenticator>
<amplify-sign-in
slot="sign-in"
header-text=""
username-alias="email"
submit-button-text="LOGIN"
hide-sign-up
></amplify-sign-in>
<div v-if="signedIn">
<Header />
<nuxt />
<Footer />
</div>
</amplify-authenticator>
Here is the response I get from the authentication request:
{"__type":"NotAuthorizedException","message":"Invalid login token. Couldn't verify signed token."}
And then when my app tries to make API calls after failing to authenticate:
{"message":"Missing Authentication Token"}
Please let me know if there’s any more information I can provide to help!
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 20 (5 by maintainers)
Thank you for this @srchulo. Putting your thinking out there helped me solve my issue too. We are using Amplify to power a Chrome extension where the user signs in to the Options page and we pass the session data to the Context via local storage.
We had a similar issue where the token was expired so calls were failing and it was because we were calling
Auth.Credentials.setwhich eventually calls Cognito with theGetIdCommandwhich failed because the session needed to be refreshed. CallingAuth.currentSessionfirst seems to have cleared up the issue!