amazon-archives / amazon-cognito-auth-js

The Amazon Cognito Auth SDK for JavaScript simplifies adding sign-up, sign-in with user profile functionality to web apps.
Apache License 2.0
424 stars 232 forks source link

check if session is valid before cache #80

Open PhilWaldmann opened 6 years ago

PhilWaldmann commented 6 years ago

calling parseCognitoWebResponse(window.location.href) (like in the sample) will throw an error if the url does contain any arbitrary fragment (e.g. https://domain.com/signin-callback.html#foo)

aws-cognito-sdk.js:11656 Uncaught TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
    at fromObject (aws-cognito-sdk.js:11656)
    at from (aws-cognito-sdk.js:11505)
    at new Buffer (aws-cognito-sdk.js:11482)
    at Object.decode64 [as decode] (aws-cognito-sdk.js:7825)
    at CognitoAccessToken.getUsername (amazon-cognito-auth.js:221)
    at CognitoAuth.cacheTokensScopes (amazon-cognito-auth.js:1267)
    at CognitoAuth.getTokenQueryParameter (amazon-cognito-auth.js:1198)
    at CognitoAuth.parseCognitoWebResponse (amazon-cognito-auth.js:1136)
    at (index):40