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.

currentSession returns 'no current user' because Cookie Storage is ignored

See original GitHub issue

Describe the bug When using cookieStorage, authentication succeeds but then fails to find the authenticated user. Tokens are stored in local storage even with cookieStorage configured.

Using React, though it seems to not matter which library/framework is used.

Versions:

"aws-amplify": "1.1.3",
"aws-amplify-react": "2.0.4"

To Reproduce Steps to reproduce the behavior:

  1. Copy minimal Amplify Auth configuration using User Pools and cookieStorage into new React project
  2. Run the application
  3. Sign in via Cognito
  4. Call Auth.currentSession()
  5. See 'no current user' error

Expected behavior The user the be authenticated, tokens to exist in cookie storage, and currentSession() to return the current session

Screenshots N/A

Desktop (please complete the following information):

  • OS: macOS High Siera 10.13.6 (17G65)
  • Browser: Chrome 70.0.3538.22, Safari 12.0 (13606.2.11)

Smartphone (please complete the following information): N/A

Additional context Note, this issue occurs whether I use the withAuthenticator HOC or if I even just hard code the credentials of the user and directly sign in with Auth.signIn

The error also occurs whether I use USER_PASSWORD_AUTH or USER_SRP_AUTH

Code

import React, { Component } from "react";
import Amplify from "aws-amplify";
import logo from "./logo.svg";
import "./App.css";
import { Auth } from "aws-amplify";
import { withAuthenticator } from "aws-amplify-react";

window.LOG_LEVEL = "DEBUG";

Amplify.configure({
  Auth: {
    region: "us-east-1",
    userPoolId: "<redacted>",
    userPoolWebClientId: "<redacted>",
    mandatorySignIn: false,
    cookieStorage: {
      domain: "localhost",
      path: "/",
      expires: 365,
      secure: true
    },
    authenticationFlowType: "USER_PASSWORD_AUTH"
  }
});

class App extends Component {
  render() {
    Auth.currentSession()
      .then(user => console.log(user))
      .catch(err => console.log(err));
    return (
      <div className="App">
        <header className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <h1 className="App-title">Welcome to React</h1>
        </header>
        <p className="App-intro">
          To get started, edit <code>src/App.js</code> and save to reload.
        </p>
      </div>
    );
  }
}

export default withAuthenticator(App, true);

You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = ‘DEBUG’; in your app.

ConsoleLogger.js:100 {[DEBUG] 12:03.858 Amplify - amplify config: {…}}
ConsoleLogger.js:84 [DEBUG] 12:03.861 I18n - configure I18n
ConsoleLogger.js:84 [DEBUG] 12:03.861 I18n - create I18n instance
ConsoleLogger.js:84 [DEBUG] 12:03.862 AnalyticsClass - configure Analytics
ConsoleLogger.js:100 {[DEBUG] 12:03.863 Parser - parse config: Array(3)}
ConsoleLogger.js:84 [WARN] 12:03.863 AWSPinpointProvider - Please ensure you have updated you Pinpoint IAM Policywith the Action: "mobiletargeting:PutEvents" in order tocontinue using AWS Pinpoint Service
./node_modules/@aws-amplify/core/lib/Logger/ConsoleLogger.js.ConsoleLogger._log @ ConsoleLogger.js:84
./node_modules/@aws-amplify/core/lib/Logger/ConsoleLogger.js.ConsoleLogger.warn @ ConsoleLogger.js:146
AWSPinpointProvider @ AWSPinpointProvider.js:74
./node_modules/@aws-amplify/analytics/lib/Analytics.js.AnalyticsClass.configure @ Analytics.js:104
(anonymous) @ Amplify.js:25
./node_modules/@aws-amplify/core/lib/Amplify.js.Amplify.configure @ Amplify.js:24
./src/App.js @ App.js:10
__webpack_require__ @ bootstrap 06c08ba3c8c28ad07c42:678
fn @ bootstrap 06c08ba3c8c28ad07c42:88
./src/index.js @ index.css?f255:26
__webpack_require__ @ bootstrap 06c08ba3c8c28ad07c42:678
fn @ bootstrap 06c08ba3c8c28ad07c42:88
1 @ lib fs:1
__webpack_require__ @ bootstrap 06c08ba3c8c28ad07c42:678
(anonymous) @ bootstrap 06c08ba3c8c28ad07c42:724
(anonymous) @ bootstrap 06c08ba3c8c28ad07c42:724
ConsoleLogger.js:100 {[DEBUG] 12:03.864 AWSPinpointProvider - configure Analytics: {…}}
ConsoleLogger.js:84 [DEBUG] 12:03.865 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 12:03.866 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 12:03.867 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 12:03.868 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 12:03.868 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 12:03.868 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 12:03.870 AuthClass - failed to get or parse item aws-amplify-federatedInfo: TypeError: Cannot read property 'getItem' of undefined
    at AuthClass../node_modules/@aws-amplify/…}
ConsoleLogger.js:84 [DEBUG] 12:03.871 AuthClass - Getting current session
ConsoleLogger.js:100 {[DEBUG] 12:03.873 Analytics - on hub capsule analytics: {…}}
ConsoleLogger.js:100 {[DEBUG] 12:03.873 AnalyticsClass - current configuration: {…}}
ConsoleLogger.js:84 [DEBUG] 12:03.874 AuthClass - configure Auth
ConsoleLogger.js:100 {[DEBUG] 12:03.874 Parser - parse config: Array(3)}
ConsoleLogger.js:100 {[DEBUG] 12:03.875 Analytics - on hub capsule auth: {…}}
ConsoleLogger.js:84 [DEBUG] 12:03.876 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 12:03.876 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 12:03.876 Credentials - getting old cred promise
ConsoleLogger.js:84 [DEBUG] 12:03.877 Storage - configure called
ConsoleLogger.js:84 [DEBUG] 12:03.878 StorageClass - configure Storage
ConsoleLogger.js:84 [DEBUG] 12:03.878 StorageClass - Do not have bucket yet
ConsoleLogger.js:84 [DEBUG] 12:03.878 StorageClass - configure Storage
ConsoleLogger.js:84 [DEBUG] 12:03.879 StorageClass - Do not have bucket yet
ConsoleLogger.js:100 {[DEBUG] 12:03.879 API - configure API: {…}}
ConsoleLogger.js:84 [DEBUG] 12:03.879 API - create API instance
ConsoleLogger.js:100 {[DEBUG] 12:03.879 RestClient - API Options: {…}}
ConsoleLogger.js:100 {[DEBUG] 12:03.880 PubSub - configure PubSub: {…}}
ConsoleLogger.js:100 {[DEBUG] 12:03.881 Interactions - configure Interactions: {…}}
ConsoleLogger.js:100 {[DEBUG] 12:03.881 XR - configure XR: {…}}
ConsoleLogger.js:100 {[DEBUG] 12:03.881 AbstractXRProvider - configure SumerianProvider: {…}}
ConsoleLogger.js:84 [DEBUG] 12:03.889 Hub - noname listening auth
ConsoleLogger.js:84 [DEBUG] 12:03.903 AuthClass - getting current authenticted user
ConsoleLogger.js:84 [DEBUG] 12:03.905 AuthClass - cannot load federated user from auth storage
ConsoleLogger.js:84 [DEBUG] 12:03.906 AuthClass - get current authenticated userpool user
ConsoleLogger.js:84 [DEBUG] 12:03.907 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 12:03.907 AuthClass - getting session failed: "No userPool"}
ConsoleLogger.js:84 [DEBUG] 12:03.909 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 12:03.910 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 12:03.911 AuthClass - The user is not authenticated by the error: "No current user"}
ConsoleLogger.js:84 [INFO] 12:03.912 Cache - Remove item: key is federatedInfo
ConsoleLogger.js:100 {[DEBUG] 12:03.913 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:100 {[DEBUG] 12:03.914 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 12:03.915 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 12:03.915 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 12:03.916 AuthClass - no current Cognito user
ConsoleLogger.js:84 [DEBUG] 12:03.917 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 12:03.917 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 12:03.917 AuthClass - cannot load guest credentials for unauthenticated user: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:100 {[DEBUG] 12:03.918 Analytics - on hub capsule auth: {…}}
ConsoleLogger.js:100 {[DEBUG] 12:03.919 Authenticator - authenticator state change signedOut: undefined}
ConsoleLogger.js:84 [DEBUG] 12:05.783 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 12:05.783 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 12:05.783 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 12:05.784 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 12:05.784 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 12:05.784 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 12:05.785 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 12:05.786 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 12:05.787 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 12:05.788 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 12:05.788 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 12:05.788 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 12:05.789 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 12:05.789 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 12:05.789 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 12:06.405 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 12:06.406 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 12:06.406 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 12:06.407 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 12:06.408 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 12:06.408 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 12:06.409 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 12:06.409 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 12:06.411 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 12:06.411 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 12:06.412 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 12:06.412 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 12:06.413 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 12:06.413 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 12:06.414 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 12:07.558 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 12:07.558 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 12:07.559 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 12:07.559 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 12:07.559 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 12:07.560 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 12:07.561 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 12:07.562 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 12:07.562 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 12:07.562 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 12:07.563 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 12:07.564 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 12:07.565 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 12:07.565 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 12:07.565 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:90 {[DEBUG] 12:19.251 AuthClass: CognitoUserSession}
ConsoleLogger.js:84 [INFO] 12:19.252 Cache - Remove item: key is federatedInfo
ConsoleLogger.js:84 [DEBUG] 12:19.253 Credentials - set credentials from session
ConsoleLogger.js:84 [DEBUG] 12:19.253 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 12:19.254 AuthClass - cannot get cognito credentials: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:100 {[DEBUG] 12:19.254 Analytics - on hub capsule auth: {…}}
ConsoleLogger.js:84 [DEBUG] 12:19.255 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 12:19.255 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 12:19.257 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 12:19.259 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 12:19.259 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 12:19.260 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 12:19.261 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 12:19.262 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 12:19.263 AuthClass - Failed to get user from user pool
ConsoleLogger.js:90 {[DEBUG] 12:19.265 SignIn: CognitoUser}
ConsoleLogger.js:100 {[DEBUG] 12:19.266 AuthClass - Getting the session from this user:: CognitoUser}
ConsoleLogger.js:100 {[DEBUG] 12:19.267 AuthClass - Succeed to get the user session: CognitoUserSession}
ConsoleLogger.js:100 {[DEBUG] 12:19.268 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 12:19.270 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 12:19.271 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 12:19.272 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 12:19.273 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 12:19.275 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:100 {[DEBUG] 12:19.364 Authenticator - authenticator state change signedIn: CognitoUser}
ConsoleLogger.js:84 [DEBUG] 12:19.369 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 12:19.371 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 12:19.372 AuthClass - Failed to get the current user: "No current user"}
App.js:30 No current user
ConsoleLogger.js:84 [DEBUG] 12:32.675 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 12:32.675 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 12:32.676 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 12:32.676 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 12:32.676 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 12:32.677 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 12:32.678 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 12:32.679 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 12:32.680 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 12:32.681 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 12:32.681 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 12:32.682 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 12:32.683 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 12:32.684 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 12:32.684 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 14:02.675 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 14:02.675 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 14:02.676 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 14:02.676 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 14:02.677 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 14:02.677 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 14:02.678 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 14:02.678 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 14:02.680 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 14:02.680 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 14:02.680 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 14:02.681 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 14:02.682 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 14:02.683 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 14:02.683 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 14:13.23 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 14:13.24 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 14:13.24 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 14:13.25 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 14:13.25 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 14:13.26 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 14:13.26 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 14:13.28 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 14:13.29 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 14:13.29 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 14:13.29 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 14:13.30 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 14:13.31 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 14:13.32 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 14:13.32 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 17:38.87 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 17:38.87 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 17:38.88 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 17:38.89 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 17:38.89 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 17:38.89 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 17:38.90 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 17:38.91 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 17:38.93 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 17:38.93 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 17:38.93 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 17:38.93 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 17:38.94 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 17:38.95 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 17:38.95 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 18:03.75 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 18:03.76 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 18:03.77 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 18:03.77 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 18:03.77 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 18:03.78 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 18:03.78 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 18:03.79 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 18:03.80 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 18:03.81 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 18:03.81 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 18:03.81 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 18:03.82 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 18:03.83 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 18:03.83 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 18:03.644 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 18:03.645 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 18:03.646 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 18:03.646 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 18:03.646 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 18:03.646 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 18:03.647 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 18:03.648 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 18:03.649 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 18:03.649 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 18:03.650 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 18:03.651 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 18:03.651 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 18:03.651 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 18:03.653 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 18:05.89 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 18:05.90 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 18:05.90 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 18:05.90 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 18:05.90 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 18:05.91 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 18:05.92 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 18:05.92 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 18:05.94 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 18:05.95 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 18:05.95 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 18:05.95 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 18:05.96 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 18:05.98 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 18:05.98 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 18:42.320 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 18:42.321 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 18:42.321 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 18:42.321 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 18:42.322 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 18:42.323 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 18:42.324 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 18:42.324 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 18:42.326 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 18:42.327 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 18:42.327 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 18:42.327 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 18:42.328 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 18:42.329 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 18:42.330 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 18:43.526 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 18:43.528 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 18:43.528 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 18:43.528 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 18:43.529 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 18:43.530 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 18:43.530 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 18:43.532 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 18:43.532 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 18:43.533 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 18:43.533 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 18:43.534 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 18:43.534 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 18:43.535 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 18:43.535 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 19:59.949 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 19:59.950 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 19:59.950 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 19:59.950 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 19:59.951 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 19:59.951 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 19:59.952 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 19:59.953 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 19:59.954 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 19:59.954 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 19:59.955 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 19:59.955 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 19:59.956 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 19:59.957 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 19:59.958 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 20:01.423 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 20:01.424 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 20:01.425 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 20:01.425 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 20:01.425 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 20:01.426 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 20:01.426 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 20:01.427 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 20:01.428 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 20:01.429 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 20:01.430 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 20:01.431 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 20:01.431 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 20:01.431 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 20:01.433 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 21:00.144 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 21:00.144 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 21:00.145 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 21:00.145 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 21:00.146 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 21:00.146 AuthClass - Getting current user credentials
ConsoleLogger.js:100 {[DEBUG] 21:00.147 AuthClass - failed to get or parse item aws-amplify-federatedInfo: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at AuthCla…}
ConsoleLogger.js:84 [DEBUG] 21:00.149 AuthClass - Getting current session
ConsoleLogger.js:84 [DEBUG] 21:00.150 AuthClass - Failed to get user from user pool
ConsoleLogger.js:100 {[DEBUG] 21:00.150 AuthClass - Failed to get the current user: "No current user"}
ConsoleLogger.js:100 {[DEBUG] 21:00.151 AuthClass - getting session failed: "No current user"}
ConsoleLogger.js:84 [DEBUG] 21:00.151 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 21:00.152 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 21:00.153 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 21:00.154 AWSPinpointProvider - cannot send events without credentials, applicationId or region

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

19reactions
choxnoxcommented, Jan 8, 2019

Actually what needed to be done is not ignore secure flag but to set it to false because it’s already true by default.

9reactions
choxnoxcommented, Jan 8, 2019

OK, after wasting 7 hours and digging through AWS Amplify code I finally managed to get it working and the problem was on my side - I set secure flag to true for the cookieStorage config while I was running the code on localhost via HTTP and not HTTPS. Ignoring secure flag in the config resulted in cookies being properly stored.

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws-amplify auth currentSession returns no current user
It looks like I cannot get user session, unless it is wrapped inside Auth.signIn. That's the Node/JS async programming model in a nutshell....
Read more >
Troubleshooting AWS CLI errors - AWS Command Line Interface
Confirm that you're running a recent version of the AWS CLI ... DEBUG - The s3 config key is not a dictionary type,...
Read more >
9 Using Sessions and Session Persistence - Oracle Help Center
Learn how to set up and use HTTP sessions and session persistence in WebLogic Server. ... Because the session is stored in the...
Read more >
MySQL 8.0 Reference Manual :: 12.16 Information Functions
Within a stored program or view, CURRENT_USER() returns the account for the ... If no LIMIT is present in the UNION , SQL_CALC_FOUND_ROWS...
Read more >
Import-Module (Microsoft.PowerShell.Core)
The Import-Module cmdlet adds one or more modules to the current session. ... imported to the session when you use any commands or...
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