question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error message assumes the Storage provider for amazon-cognito-identity.js is "LocalStorage"

See original GitHub issue

Before opening, please confirm:

JavaScript Framework

Not applicable

Amplify APIs

Not applicable

Amplify Categories

No response

Environment information

# Put output below this line


Describe the bug

CognitoUser.js#L1444 (in the getSession function) assumes that one is using the default window.LocalStorage instead of a (supported) override configured via the Storage key.

The code is

new Error('Local storage is missing an ID Token, Please authenticate'),

It might be more generically correct for the code to be

new Error('Storage is missing an ID Token, Please authenticate'),

allowing for the case where the app chooses to override the default LocalStorage in favor of a different approach.

Expected behavior

new Error('Storage is missing an ID Token, Please authenticate'),

Reproduction steps

Call cognitoUser.signOut(revokeCallback); without an ID Token in Storage. The revokeCallback function is called back with an error arg which contains the “overspecified” text in question:

'Local storage is missing an ID Token, Please authenticate'

Code Snippet

// Put your code below this line.
new Error('Local storage is missing an ID Token, Please authenticate'),

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jrobbins-LiveDatacommented, Oct 1, 2021

Hey @chrisbonifacio, I’m inexperienced at Pull Requests. I tried to do it better this time. Hope I got it! If not, please let me know.

1reaction
jrobbins-LiveDatacommented, Sep 30, 2021

Happy to!

Read more comments on GitHub >

github_iconTop Results From Across the Web

localStorage usage should be optional · Issue #87 - GitHub
CognitoUser.signOut(). make it obvious that getCurrentUser() is referring to a persistant store; provide support for altenative storage ...
Read more >
Local storage is missing an ID Token, Please authenticate
Getting Local storage is missing an ID Token, Please authenticate. My end goal is to get the user signed up through AWS Cognito...
Read more >
amazon-cognito-identity-js - npm
Amazon Cognito Identity Provider JavaScript SDK. ... onSuccess will be called immediately (assuming there is no error). cognitoUser.
Read more >
Amazon Cognito authentication issues with OpenSearch ...
This error message occurs when Amazon Cognito doesn't have the proper permissions to assume an IAM role on behalf of the authenticated user....
Read more >
amazon-cognito-identity-js | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found