Get Credentials from Amazon Cognito in pure Java

485 views Asked by At

how can I get credentials like access key security key and session token from Amazon Cognito Identity in pure java using only IDENTITY_POOL_ID and Region?

Like on Android but without application context

CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
  getApplicationContext(), // Context
  "IDENTITY_POOL_ID", // Identity Pool ID
  Regions.US_EAST_1 // Region
);

Is it possible with Amazon SDK for Java or pure Http request? If it is, how can I do it?

1

There are 1 answers

0
Piotr K. On BEST ANSWER

I've found a solution, CognitoCachingCredentialsProvider extends CognitoCredentialsProvider so just use base class

CognitoCredentialsProvider credentialsProvider = new CognitoCredentialsProvider(
            COGNITO_POOL_ID,
            MY_REGION
    );