amazon-archives / amazon-cognito-identity-js

Amazon Cognito Identity SDK for JavaScript
Other
985 stars 451 forks source link

Different CognitoUserPool methods between Webpack and using Script tags - I can't getCurrentUser with Webpack #474

Closed villagebike closed 7 years ago

villagebike commented 7 years ago

Hello, I am trying to follow the latest guide which allows CognitoIdentity to be used with Webpack. However, I can no longer use getCurrentUser() to return the authentication details once I refresh the page after a successful login. Using webpack to import Cognito I get the following UserPool Object

 {
  "userPoolId": "us-west-2_DKJaaaaa",
  "clientId": "1arl8pglu5aaaaaaaaaaaaa",
  "client": {
    "config": {
      "credentials": {
        "expired": false,
        "expireTime": null,
        "accessKeyId": "anything"
      },
      "credentialProvider": null,
      "region": "us-west-2",
      "logger": null,
      "apiVersions": {},
      "apiVersion": "2016-04-19",
      "endpoint": "cognito-idp.us-west-2.amazonaws.com",
      "httpOptions": {
        "timeout": 3600000
      },
      "maxRedirects": 10,
      "paramValidation": true,
      "sslEnabled": true,
      "s3ForcePathStyle": false,
      "s3BucketEndpoint": false,
      "s3DisableBodySigning": true,
      "computeChecksums": true,
      "convertResponseTypes": true,
      "correctClockSkew": false,
      "customUserAgent": null,
      "dynamoDbCrc32": true,
      "systemClockOffset": 0,
      "signatureVersion": "v4",
      "signatureCache": true,
      "retryDelayOptions": {},
      "useAccelerateEndpoint": false
    },
    "isGlobalEndpoint": false,
    "endpoint": {
      "protocol": "https:",
      "host": "cognito-idp.us-west-2.amazonaws.com",
      "port": 443,
      "hostname": "cognito-idp.us-west-2.amazonaws.com",
      "pathname": "/",
      "path": "/",
      "href": "https://cognito-idp.us-west-2.amazonaws.com/"
    },
    "_clientId": 1
  },
  "storage": {}
}

When I import using Githubissues.

  • Githubissues is a development platform for aggregating issues.