use of com.amazonaws.services.cognitoidentity.model.NotAuthorizedException in project aws-sdk-android by aws-amplify.
the class OAuth2Utils method getCredentials.
@Override
public AWSCredentials getCredentials() {
if (isLegacyMode()) {
return IdentityManager.getDefaultIdentityManager().getCredentialsProvider().getCredentials();
}
if (cognitoIdentity == null) {
throw new AmazonClientException("Cognito Identity not configured");
}
try {
if (waitForSignIn()) {
Log.d(TAG, "getCredentials: Validated user is signed-in");
}
AWSSessionCredentials credentials = cognitoIdentity.getCredentials();
mStore.set(IDENTITY_ID_KEY, cognitoIdentity.getIdentityId());
return credentials;
} catch (NotAuthorizedException e) {
Log.w(TAG, "getCredentials: Failed to getCredentials from Cognito Identity", e);
throw new AmazonClientException("Failed to get credentials from Cognito Identity", e);
} catch (Exception e) {
throw new AmazonClientException("Failed to get credentials from Cognito Identity", e);
}
}
use of com.amazonaws.services.cognitoidentity.model.NotAuthorizedException in project aws-sdk-android by aws-amplify.
the class NotAuthorizedExceptionUnmarshaller method unmarshall.
@Override
public AmazonServiceException unmarshall(JsonErrorResponse error) throws Exception {
NotAuthorizedException e = (NotAuthorizedException) super.unmarshall(error);
e.setErrorCode("NotAuthorizedException");
return e;
}
Aggregations