AWS Cognito certificateProvider.login始终显示NIL(SWIFT) [英] AWS Cognito credentialsProvider.login always shows NIL (SWIFT)

查看:115
本文介绍了AWS Cognito certificateProvider.login始终显示NIL(SWIFT)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用AWS Cognito实施Facebook登录。
从Facebook接收访问令牌后,我无法更新凭据提供程序。

I'm trying to implement Facebook Login with AWS Cognito. After receiving the access token from Facebook, I'm not able to update the credentials provider.

let token = FBSDKAccessToken.currentAccessToken().tokenString
credentialsProvider.logins = [AWSCognitoLoginProviderKey.Facebook.rawValue: token]

在此之后,如果我打印 [AWSCognitoLoginProviderKey.Facebook.rawValue:令牌] ,我得到的是长字符串,但如果我打印 credentialsProvider.logins 我得到 NIL

After this, if I print [AWSCognitoLoginProviderKey.Facebook.rawValue: token] I get the long string but if I print credentialsProvider.logins I get NIL.

结果是,我的身份池始终将用户显示为

As a result, my identity pool always shows the user as unauthenticated even after logging in with Facebook.

任何帮助将不胜感激。
谢谢!!

Any help would be appreciated. Thanks!!

推荐答案

您是否正在使用最新的AWS iOS SDK?如果是,则credentialProvider.logins将始终为NIL,并会导致您的应用创建未经身份验证的身份。

Are you using the latest AWS iOS SDK? If yes, then credentialProvider.logins will always be NIL and will cause your app to create unauthenticated identities.

我们正在为此更新文档,但实际上这是

We are in process of updating our documentation for this but essentially this is what you need to do.

使用此构造函数以创建凭据提供程序。这里的 identityProviderManager 应该是 AWSIdentityProviderManager协议 logins 方法应将您的提供商名称的字典映射返回给令牌。凭据提供者每次需要身份提供者令牌时都会调用此方法。

Use this constructor to create the credentials provider. The identityProviderManager here should be an implementation of AWSIdentityProviderManager Protocol and the logins method should return the dictionary mapping for your provider name to the token. The credentials provider will call this method every time it needs the identity provider token.

这篇关于AWS Cognito certificateProvider.login始终显示NIL(SWIFT)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆