menu arrow_back close search On Github

Access user information

  1. Home
  2. Android SDK integration
  3. Access user information

Add claims

The SDK allows for two ways of accessing user information. Either by requesting and accessing an IdToken or by making a network call using getUserInfo(…).

The presence of the fields depend on the scope and claim variables that were given at sign-in time. Set the scope to access these fields and set the claims to make sure that the user has something in these fields. See for more details.

To set claims use the setClaims method on the ConnectLoginButton.

public void onCreate(Bundle savedInstanceState) {
    // ...
    ConnectLoginButton button = (ConnectLoginButton) findViewById(;
    button.setClaims(new Claims(Claims.PHONE_NUMBER, Claims.EMAIL));

Access User Information by IdToken

When authenticating the user make sure to request the openid scope:

protected void onCreate(Bundle savedInstanceState) {

    ConnectLoginButton loginButton = (ConnectLoginButton) findViewById(;

When the user has authenticated you call:

IdToken idToken = ConnectSdk.getIdToken();

And access user information by calling for example:

String email = idToken.getEmail();

Access User Information by getUserInfo(…)

You can also access user information by making a network call using getUserInfo(…):

ConnectSdk.getUserInfo(new Callback<UserInfo>() {
    public void success(UserInfo userInfo, Response response) {
        // app code

    public void failure(RetrofitError error) {
        // app code
Edit this page