1
votes

We are using AWS Mobile Hub SDK into the android application. We have two options for login into the application using Facebook and Custom Email login. For that In AWS Mobile Hub console under the build options we enable both options for android platform.

  1. Facebook
  2. Custom

Then build the package it would generate the Sample Source Package. We integrated the sample source package into the application for facebook login into the application using mobile HUB.

Now I was wondering about custom login. For that I see that in AWS it's called developer authentication identity. I study the AWS Cognito developer authentication developer-authenticated-identities.

I could able to run the sample application of the AWS Cognito Developer Authentication here

I see that for the developer authenticated identities involves interaction between the end user device, third party backend for authentication. We create the RESET API for new user account creation and authenticate the user by login using our android application.

Our backend Register API can create the new user into the system and generate the new identity id under the identity pool and get the token from the AWS. It's store inside the backend database.

In android application when user try to login we make the login call it will return the token ID and identity ID Here I could not able to understand that where we have to pass this token ID and identity ID. Because we already implement the Facebook login. It's working fine. I can see that the build package of the facebook login. We have Identity Manager class has method for provide the AWSCredentialProvider. We use two main class/interface Identity Provider and Identity Manage for access the Dynamodb.

How to use token and identity id for access the AWS resource?.

Kindly please help me into it if anybody know how to implement into the android application?

Thank you

1

1 Answers

1
votes

You need to set this token in the logins map inside the CognitoCachingCredentialsProvider. The steps should be

  1. get the current logins
  2. Add the key cognito-identity.amazonaws.com with the token as value in the logins map
  3. set the logins in credential provider

On next refresh you will get credentials which will be associated to the identity your back end generated. You can even force the refresh on your own by calling the refresh method on credential provider.

This process is well explained in the documentation you linked and in this post. Our Android sample application also demonstrates the use of developer authenticated identities, you can use this as a starting guide.