Example usage for com.amazonaws.services.cognitoidentity.model GetOpenIdTokenResult getToken

List of usage examples for com.amazonaws.services.cognitoidentity.model GetOpenIdTokenResult getToken

Introduction

In this page you can find the example usage for com.amazonaws.services.cognitoidentity.model GetOpenIdTokenResult getToken.

Prototype


public String getToken() 

Source Link

Document

An OpenID token, valid for 10 minutes.

Usage

From source file:io.fineo.client.auth.AWSAbstractCognitoIdentityProvider.java

License:Open Source License

/**
 * With the logins and identityId to mark the user, it builds a request to
 * the cognito back end, and returns the token cib hands back
 *//*ww w  .  j a  va 2s  .  c om*/
@Override
public String getToken() {
    if (this.token == null) {
        GetOpenIdTokenRequest getTokenRequest = new GetOpenIdTokenRequest().withIdentityId(getIdentityId())
                .withLogins(loginsMap);

        appendUserAgent(getTokenRequest, getUserAgent());

        GetOpenIdTokenResult getTokenResult = cib.getOpenIdToken(getTokenRequest);

        if (!getTokenResult.getIdentityId().equals(getIdentityId())) {
            identityChanged(getTokenResult.getIdentityId());
        }
        this.token = getTokenResult.getToken();
    }
    return token;
}