AWS.config.credentials are null between page requests

3.4k views Asked by At

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

There are 1 answers

0
perpil On BEST ANSWER

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