amplify-js: Auth.currentUserInfo() not returning cognitoIdentityId

Since updating to "aws-amplify-react-native": "^0.2.2" running Auth.currentUserInfo() is not returning the cognitoIdentityId it just says id: undefined

{ id: undefined,
username: 'ivan2',
attributes:
{ email_verified: true,
phone_number_verified: false,
phone_number: '+555555555555',
email: '*********@gmail.com' } }

We are using this function to get the userInfo on login, then we store it to user storage, as suggested here https://github.com/aws/aws-amplify/issues/54#issuecomment-360958293

Is this still the correct function to get the cognitoId? What should we be using?


EDIT: I meant currentUserInfo [ Sorry, I guess I shound’t write issues at 2am 😆 ] Still, the function is returning id: undefined

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 15 (6 by maintainers)

Most upvoted comments

still getting an undefined id here, amplify version is 0.2.11:

import { Auth } from 'aws-amplify';

const { id } = await Auth.currentUserInfo();   // id is undefined

@mlabieniec I’m getting the same id: undefined

I don’t know if this is related with us using the withAuthenticator HOC

Thanks

@Darkade can you try

"aws-amplify": "^0.2.4",

I just tested here with a fresh install and i do get the id when using the method:

let info = await Auth.currentUserInfo();
{
  "id": "us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
  "username": "mlab",
  "attributes": {
    "email_verified": false,
    "phone_number_verified": true,
    "phone_number": "+xxxxxxxxxxx",
    "email": "xxxxxxx@gmail.com"
  }
}

@Darkade There is currentUserInfo() method that returns user object with id

{
  id: 'us-east-1:500af417-2b3d-6da3-852b-ac1c5dc45dcd',
  username: 'testUser',
  attributes: {
    // ...
  }
}

Does it work for you?