AWS.config.credentials are null between page requests

末鹿安然 提交于 2019-12-01 22:20:26

问题


I'm using Facebook to create an authenticated identity via AWS Cognito, that's all working fine and I can login, and synchronise data.

However, if I navigate away from my sign-in page - but remain in my site - the underlying AWS.config.credentials object is then null and I can't synchronise any data via a different page.

Suspect I'm missing something obvious but can't see it from the Amazon docs and don't know what!

Edit: Sorry - should have added - this is via the Javascript SDK


回答1:


Only the identity id is maintained between pages, credentials are not. You will need to cache the Facebook token and supply it to the credentials object when you transition between pages to get AWS credentials. You will also need to track expiry of the Facebook token so can refresh your cached token if it has expired. This forums post has more details on the process. https://forums.aws.amazon.com/thread.jspa?threadID=179420&tstart=25



来源:https://stackoverflow.com/questions/31025339/aws-config-credentials-are-null-between-page-requests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!