Skip to content

User Id is null when user is signed in #622

@CriPstian

Description

@CriPstian

Hi there, I need help implementing some basic functionality and can't figure it out with the help of the documentation. Let me know if there is need for more logs or information. Thanks!

Signing in users
Using sign in on Android with Facebook or with Google signs in with success but does not provide access to username or any attribute due to userId being null.
I want to be able to extract the basic information like username or email to let the user know how they are signed in.

AWS Services
Went through amplify example and tutorial step by step, also just by using the android sdk and configuraiton in the AWS Console.

** Exceptions **
After the sign in is completed, the onResult callback will come back with a SIGNED_IN user state (which is awesome).

  • Trying to access username will return null:
login.text = "Logged in as ${AWSMobileClient.getInstance().username}"

result:
Logged in as null

  • Trying to access user attributes raises an exception
Log.v("MyTag", "User has ${AWSMobileClient.getInstance().userAttributes.size} attributes")

result:

CognitoNotAuthorizedException: User-ID is null

** Build environment **

ext {
    kotlin_version = '1.3.11'
    supportlibVersion = '1.1.0-alpha01'
}

dependencies:

//Base SDK
    implementation 'com.amazonaws:aws-android-sdk-core:2.9.0'
    //AppSync SDK
    implementation 'com.amazonaws:aws-android-sdk-appsync:2.6.28'

    //For AWSMobileClient only:
    implementation 'com.amazonaws:aws-android-sdk-mobile-client:2.9.0'

    //For the drop-in UI also:
    implementation 'com.amazonaws:aws-android-sdk-auth-userpools:2.9.0'
    implementation 'com.amazonaws:aws-android-sdk-auth-ui:2.9.0'

    // Facebook SignIn
    implementation('com.amazonaws:aws-android-sdk-auth-facebook:2.8.0')

    // Google SignIn
    implementation('com.amazonaws:aws-android-sdk-auth-google:2.8.0')

Device Information

  • Device: Samsung Galaxy S8, Google Pixel
  • Android Version: Marshmallow

Metadata

Metadata

Assignees

Labels

feature-requestRequest a new featuremobile clientIssues with AWS Mobile's client-side Cognito wrapper

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions