I created a group of lambda functions to perform all my authentication. I connect from my application through the api gateway and then finally call GetOpenIdTokenForDeveloperIdentity (). This returns the identifier and token to my device through the gateway.
Next, follow the instructions on this site (for Objective-C): http://docs.aws.amazon.com/cognito/latest/developerguide/developer-authenticated-identities.html
Since I have an identifier and a token, I started with this:
DeveloperProvider.h
DeveloperProvider.m
@implementation DeveloperProvider /* * Use the token method to communicate with your backend to get an * identityId and token. */ // Below gave me an error and changed to: - (AWSTask <NSString *> *) token - (AWSTask <NSString*>) token { //Write code to call your backend: //Pass username/password to backend or some sort of token to authenticate user //If successful, from backend call getOpenIdTokenForDeveloperIdentity with logins map //containing "your.provider.name":"enduser.username" //Return the identity id and token to client //You can use AWSTaskCompletionSource to do this asynchronously // Added this in to the code NSString *identityId = @"IdentityIdFromGateway"; NSString *token = @"TokenGotFromGatewayToo"; // Changed below code from this: // Set the identity id and return the token // self.identityId = response.identityId; // return [AWSTask taskWithResult:response.token]; // to this: self.identityId = identityId; return [AWSTask taskWithResult:token]; } @end
I get two errors from above:
- In the .h file, I get "Can't find interface for AWSCognitoCredentialsProviderHelper"
- In the .m file, I get 'identityId - this is a read-only assignment of the self.identityId property'
I reinstalled CocoaPods and reinstalled aws-ios-sdk. I even cleared all old files and received data.
Am I missing something? The ultimate goal is to be able to authenticate the user with access to the dynamodb and s3 call directly from the application without using a gateway and lambda more than the user is authenticated. Thanks.
source share