Auth0 Home Blog Docs

Android: Unable to get UserInfo


We are working to implement Auth0 for an Android app.
I have successfully run some test code, am able to login and am able to get a UserProfile.
However, the fields in the userprofile are all blank. I can log in to our Auth0 user listing and see the account (mine) and can confirm all the fields (ID, name and some App meta-data) are all populated.
When I try to debug through, I again field the fields of interest to be empty.
Can someone please review my code:

private void login() {
            .withAudience(String.format("https://%s/userinfo", getString(R.string.com_auth0_domain)))
            .start(MainActivity.this, new AuthCallback() {
                public void onFailure(@NonNull Dialog dialog) {
                    // Show error Dialog to user

                public void onFailure(AuthenticationException exception) {
                    // Show error to user

                public void onSuccess(@NonNull Credentials credentials) {
                    // Store credentials
                    // Navigate to your main activity
                    if (credentials.getAccessToken() == null)
                    Log.i("login", "onSuccess");
                    mUserClient = new UsersAPIClient(mAccount, credentials.getIdToken());

                    AuthenticationAPIClient authenticationClient = new AuthenticationAPIClient(mAccount);
                            .start(new BaseCallback<UserProfile, AuthenticationException>() {

                                public void onSuccess(final UserProfile userProfile) {
                                    mUserProfile     = userProfile;
                                    mUserID          = userProfile.getId();
                                    mUserLoginName   = userProfile.getName();  // Email address
                                    mUserName        = (String) userProfile.getAppMetadata().get("name");
                                    mUserPermissions = (String) userProfile.getAppMetadata().get("permission");
                                    mUserProvId      = (String) userProfile.getAppMetadata().get("providerId");
                                    Log.i("login", String.format("Login=%s; Name=%s; Perms=%s; ProvId=%s", mUserLoginName, mUserName, mUserPermissions, mUserProvId));

                                public void onFailure(AuthenticationException error) {
                                    //show error


Here is a screenshot from the debug session when stopped on line assigning mUserName:



:wave: @kevinashaw

You will need to specify the appropriate scopes for you to read the user profile. To do this, can you pass the scope to WebAuthProvider by adding .withScope("openid profile email”). You can add this after passing the audience.

When you call /userInfo in the AuthenticationAPIClient instance, the profile obtained is OIDC-conformant. What this means is the result will not contain fields outside the OIDC specification (standard claims). Such fields outside the standard ones include the user_metadata and app_metadata. Therefore to be able to access app metadata you will need to create a custom claim.