Tag: amazon cognito

“login”已弃用:使用“AWSIdentityProviderManager”

我一直在尝试使用Amazon Cognito在iOS和iOS上对用户进行身份validation。 我不能执行,因为官方文件是旧的。 这是我的代码: NSString *token = [FBSDKAccessToken currentAccessToken].tokenString; credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionAPNortheast1 identityPoolId:IDENTITY_POOL_ID]; AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionAPNortheast1 credentialsProvider:credentialsProvider]; credentialsProvider.logins = @{ AWSIdentityProviderFacebook: token }; NSLog(@"credentialsProvider.logins : %@", credentialsProvider.logins); [AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration; 但Xcode说'logins' is deprecated: Use “AWSIdentityProviderManager” to provide a valid logins dictionary to the credentials provider 我发现credentialsProvider.logins返回[null],因为login已被弃用。 亚马逊的官方文件(英文,日文)和样本不是最新的,所以我不知道如何正确实现对用户进行身份validation。 最后,我在Swift中find了这个解决scheme,但是我不知道。 AWS […]

亚马逊AWS SNS:我如何订阅从iOS的SNS主题?

首先,我在这里find了同样的问题,但这不起作用…也许AWS SDK更改或其他内容,我不知道为什么…我想从我的iOS应用程序订阅SNS主题。 我正在尝试使用该答案的代码,我试图改变以摆脱错误: AWSSNS *sns = [AWSSNS defaultSNS]; AWSSNSCreatePlatformEndpointInput *endpointRequest = [AWSSNSCreatePlatformEndpointInput new]; endpointRequest.platformApplicationArn = @"arn:aws:sns:us-east-1:753780999999:app/APNS_SANDBOX/MyAppDevelopment"; endpointRequest.token = [self deviceTokenAsString:deviceToken]; [[[sns createPlatformApplication:endpointRequest] continueWithSuccessBlock:^id(AWSTask *task) { AWSSNSCreateEndpointResponse *response = task.result; AWSSNSSubscribeInput *subscribeRequest = [AWSSNSSubscribeInput new]; subscribeRequest.endpoint = response.endpointArn; subscribeRequest.protocols = @"application"; subscribeRequest.topicArn = @"arn:aws:sns:us-east-1:753780999999:MyAppDevelopingTest"; return [sns subscribe:subscribeRequest]; }] continueWithBlock:^id(AWSTask *task) { if (task.cancelled) { NSLog(@"Task cancelled"); […]

使用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 […]

使用AWS Cognito Developer Identities从我的ios应用程序获取对DynamoDB的完全访问权限

我已经实施了AWS Lambdafunction,并使用网关返回填充数据: var param = { IdentityPoolId: "actualIdentityPoolId", Logins: {} // To have provider name in a variable }; param.Logins["com.testing.userLogin"] = userId; cognitoidentity.getOpenIdTokenForDeveloperIdentity(param, function(err, data) { if (err) return fn(err); // an error occurred else fn(null, data.IdentityId, data.Token); // successful response }); 所以身份标识和令牌被发送回ios设备。 在我的设备中,我尝试连接到AWS DynamoDB表,但访问被拒绝。 我如何使用identityId和令牌访问表? 我在IAM中为Unauth设置了angular色,拒绝Dydnamo和Auth,通过它的策略访问表。 我试图执行身份validation使用: http : //docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html 我看到有两个基本和增强的stream程。 该文档说,大多数用户将使用增强stream,并实现GetCredentialForIdentity。 这是如何实现在我的IOS代码,以便我可以将我的angular色从unauth切换到身份validation,并可以访问dynamodb? 这个访问会持续多久? […]

validation用户使用AWS IOS SDK进行身份validation

我创build了一个lamdba函数,它执行以下操作: var param = { IdentityPoolId: "us-east-1:the-full-identity-id", Logins: {} // To have provider name in a variable }; param.Logins["com.test.website.login"] = userIdICreatedAndStoredInDynamoDB; cognitoidentity.getOpenIdTokenForDeveloperIdentity(param, function(err, data) { if (err) return fn(err); // an error occurred else fn(null, data.IdentityId, data.Token); // successful response }); 它返回该用户的身份标识和标记。 所有内容都通过IAMangular色和AWS Cognito Identity进行设置,并在控制台中显示为正在进行身份validation。 我有两个问题: 如何在应用程序中testing用户的身份validation? 我将身份标识和令牌保存在应用程序设备中。 authentication持续多久? 我希望用户保持login。这是我使用的大多数应用程序的工作方式,并保持login状态直到他们登出。 谢谢。