Aws Cognito iOS Developer Authenticated Identities

Amazon Cognito set identityId using developer authentication Obj C

identityId field in AWSCognitoCredentialsProvider instance has readonly attribute so it cannot be changed once it initialized. The only way to set it is in its initialization.

id<AWSCognitoCredentialsProvider> credentialsProvider =
[[AWSCognitoCredentialsProvider alloc]
initWithRegionType:<Region>
identityProvider:identityProvider
unauthRoleArn:nil
authRoleArn:nil];

After the user is authenticated make sure to update the logins map as follow:

credentialsProvider.logins = @{DeveloperProviderName: userIdentifier}
[credentialsProvider refresh];

source: http://docs.aws.amazon.com/cognito/latest/developerguide/developer-authenticated-identities.html

p.s.: make sure you implement the identity provider correctly and in the refresh method you should set the identityId

- (AWSTask *)refresh {
/*
* Get the identityId and token by making a call to your backend
*/
// Call to your backend

// Set the identity id and token
self.identityId = response.identityId;
self.token = response.token;
return [AWSTask taskWithResult:self.identityId];
}

AWS Cognito Developer Authenticated Identities and Upload to S3

I think you are switching cognitio with IAM.
Cognito is used as an identity-provider for your own application or mobile app. It is a cloud identity provider which you can use as a service. You can allow other users to sign up throughout your own UI and combine this with Facebook, Google, ...

IAM is used to identify who can use these cloud services like Cognito, S3, EC2. Which roles are required to use s3 etc.

The reason why it works without authentication is cause you have probably installed the AWS SDK or cli which stores this IAM information. Your application will use it as a fallback.

Take a look at IAM,create a developer role which can access S3 and assume that Role. Get the secret and access keys for your account and you can forget Cognito for now/p>

More info:

http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html

http://docs.aws.amazon.com/cli/latest/userguide/cli-roles.html

AWS Cognito - How to update developer authenticated users token?

You should not use a randomly generated token which changes on sign in as a user identifier, if you want the user to always have the same identity id. We identify the user uniquely based on the identifier you pass us. For example, you can use the user name in the logins map when you call GetOpenIdTokenForDeveloperIdentity from your backend.

If we already have an identity generated for the identifier and that identity does not match the identity you passed in the request, we will merge these two along with their datasets.

More details about developer authenticated flow can be found in our dev guide.



Related Topics



Leave a reply



Submit