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() {
WebAuthProvider.init(mAccount)
.withScheme("demo")
.withAudience(String.format("https://%s/userinfo", getString(R.string.com_auth0_domain)))
.start(MainActivity.this, new AuthCallback() {
@Override
public void onFailure(@NonNull Dialog dialog) {
// Show error Dialog to user
}
@Override
public void onFailure(AuthenticationException exception) {
// Show error to user
}
@Override
public void onSuccess(@NonNull Credentials credentials) {
// Store credentials
// Navigate to your main activity
if (credentials.getAccessToken() == null)
return;
Log.i("login", "onSuccess");
mUserClient = new UsersAPIClient(mAccount, credentials.getIdToken());
AuthenticationAPIClient authenticationClient = new AuthenticationAPIClient(mAccount);
authenticationClient.userInfo(credentials.getAccessToken())
.start(new BaseCallback<UserProfile, AuthenticationException>() {
@Override
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));
}
@Override
public void onFailure(AuthenticationException error) {
//show error
}
});
}
});
}
Here is a screenshot from the debug session when stopped on line assigning mUserName:
cid:F28587EA-D674-4E18-9A3C-F54EE4B181CA
Regards,
Kevin