Can I authenticate using AWS Cognito with plain Java?

I want to test user authorization with Cognito and do it with simple java code. The problem is that CognitoCachingCredentialsProvider requires an Android ApplicationContext and does not accept a null value.

The whole stream should go as follows:

  • User logs in using email and password
  • Backend (Lambda function) receives an IdentityToken from Cognito and returns it to the user
  • The user can now retrieve credentials from Cognito and initialize the ApiClientFactory to authorize calls to other API endpoints.

Is there something that I am missing, or am I just mistaken in general? Any good lessons on this? I’ve already looked at all kinds of AWS documents, but it’s really hard for me to wrap it around, and there is not a single material in plain Java, but only on Android.

+4
source share
2 answers

Amazon Cognito "" , JavaScript-, AWS . Java, , - Android, Android, Java, Java SDK.

Amazon Cognito Authenticated Identities , , , OpenID Connect Amazon Cognito GetOpenIdTokenForDeveloperIdentity (). .

Cognito API GetCredentialsForIdentity (Java docs), Server Side , AWS Session Credentials Java SDK. ( AWS Security Token Service/STS) BasicSessionCredentials, , Java SDK.

+5

Source: https://habr.com/ru/post/1610433/


All Articles