问题描述
我正在使用Amazon的AWS Cognito以及Lambda和Facebook登录创建一个小型API.
I'm creating a small API using Amazon's AWS Cognito as well as Lambda and a Facebook Login.
当用户/我的应用向Lambda发送API请求时,Cognito会出色地完成工作,并通过其Facebook登录即时对用户进行身份验证.我的观点是,据我所知,Cognito不会处理有关用户的任何信息(例如ID或Fb访问令牌),当然我会在请求中提供该信息.
When a user / my App sends an API request to Lambda, Cognito does a good job and authenticates the user with it's Facebook-Login on the fly. My point is that as far I can see, Cognito isn't handing on any information about the user (like an ID or the Fb access token), except I'm providing it in my request of course.
就我而言,我想让用户使用AWS Lambda中的Facebook访问令牌来做一些事情.
In my case, I'd like to get the users Facebook access token in AWS Lambda to do some stuff with it.
有人知道如何获取当前用户的任何信息,这些信息正在击中API(例如Fb访问令牌),还是Cognito以这种方式成为封闭系统?
Does anyone know how to get any information of the current user, which is hitting the API (like the Fb access token) or is Cognito a closed system in this way?
推荐答案
如果您将Facebook集成与Cognito用户池一起使用(在联合身份验证->身份提供者下),则可以将access_token从Facebook集成映射到可用的通过进入联合身份验证->属性映射-> Facebook标签来启用Cognito属性. Facebook ID是用户名,减去"Facebook_"前缀.
If you are using the Facebook integration with Cognito User Pool (under federation -> identity providers), you can then map the access_token from the facebook integration to a useable Cognito attribute by going to federation -> attribute mapping -> Facebook tab. the facebook ID is the username, minus the "Facebook_" prefix.
希望这会有所帮助!
这篇关于在AWS Cognito和Lambda中获取Facebook访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!