AWS.config.credentials are null between page reque

2019-02-25 06:16发布

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条回答
beautiful°
2楼-- · 2019-02-25 07:16

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

查看更多
登录 后发表回答