Search code examples
javaandroidfacebook-graph-apiauth0

auth0 get further information about userProfile in Android


I'm working with Auth0 and Android. My purpose is to retrieve more information about user, more than Email and Name,like for exemple the user's birthday. But I can not doing that even any other filed When I've log the userProfile object; I've got all information which I like to have. but when I like to display for exemple the birthday in textView; I got this error

error: cannot find symbol method getGender()

this is how I write the simple piece of code:

birthdayTextView.setText(String.format(getString(R.string.birthday), userProfile.getGender()));

Solution

  • The error indicates that there is no userProfile.getGender() function.

    The Auth0 normalized user profile contains these attributes.

    Copying below for completeness. But note that gender is not available.

    Possible work-arounds:

    a). It is possible to add custom claims to user_metadata (editable by end user) or app_metadata (not editable by end user).

    b). It is also possible to add a custom claim to a token via a Rule.

    Normalised User Profile Claims

    app_metadata: the custom fields storing information about a user. These attributes contain information that influences the user's access;
    
    blocked*: the true/false value indicating if the user has been blocked;
    
    created_at: the timestamp of when the user profile was first created;
    
    email (unique): the user's email address
    
    email_verified: the true/false value indicating if the user has verified their email address;
    
    identities: the array of objects with information about the user's identities:
    
    connection: the name of the connection used to authenticate the user;
    isSocial: the true/false value indicating if the connection is a social one or not;
    provider: the entity that is authenticating the user (such as Facebook, Twitter, and so on);
    user_id: the user's unique identifier for this connection/provider.
    multifactor: the list of multifactor providers in which the user is enrolled;
    
    last_ip*: the IP address associated with the user's last login;
    
    last_login*: the timestamp of when the user last logged in;
    
    logins_count*: the number of times the user has logged in;
    
    name: the user's name;
    
    nickname: the user's nickname;
    
    phone_number: the user's phone number;
    
    phone_verified: the true/false value indicating whether the user's phone number has been verified (only valid for users with SMS connections);
    
    picture: the user's profile picture, click here to learn more about the picture field;
    
    updated_at: the timestamp of when the user's profile was last updated/modified;
    
    user_id (unique): the user's unique identifier;
    
    user_metadata: the custom fields storing information about a user. These attributes should contain information about the user that does not impact what they can or cannot access (such as work and home addresses);
    
    username (unique): the user's username.