我从AWS文档中获得以下代码:
@implementation DeveloperAuthenticatedIdentityProvider / * *使用令牌方法与后端通信以获得 * identityId和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
// Set the identity id and return the token
self.identityId = response.identityId;
return [AWSTask taskWithResult:response.token];
}
@end
我如何返回(AWSTask)?我有另一种方法的令牌,它是NSString *令牌形式。
文档: http://docs.aws.amazon.com/cognito/latest/developerguide/developer-authenticated-identities.html