使用AWS Cognito和aws-ios-sdk v.2.4.16以及开发人员身份

我build立了一组lambda函数来完成我所有的身份validation。 我通过API网关从我的应用程序连接,然后最后调用GetOpenIdTokenForDeveloperIdentity()。 这将通过网关向我的设备返回一个identityId和令牌。

接下来,我遵循这个网站的指示(Objective-C): http : //docs.aws.amazon.com/cognito/latest/developerguide/developer-authenticated-identities.html

由于我有身份标识和令牌,我开始这个:

DeveloperProvider.h

#import <AWSCore/AWSCore.h> @interface DeveloperProvider : AWSCognitoCredentialsProviderHelper @end 

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 

我从上面得到两个错误:

  1. 在.h文件中,我得到'找不到AWSCognitoCredentialsProviderHelper的接口'
  2. 在.m文件中,我得到'identityId是一个只读的属性self.identityId'

我重新安装了CocoaPods并重新安装了aws-ios-sdk。 我甚至清理了所有旧文件和派生数据。

我错过了什么吗? 最终目标是能够让一个经过authentication的用户可以直接从应用程序中直接调用dynamodb和s3,而无需使用网关和lambda,而且用户通过了authentication。 谢谢。