embedded icon indicating copy to clipboard operation
embedded copied to clipboard

Automatically refresh the auth token in the example app

Open taylorreece opened this issue 1 year ago • 0 comments

It's best practice to generate short-lived JWTs for the embedded markeplace, and to refresh the tokens before they expire. This adds a new config setting to the example embedded app, tokenValidSeconds, which determines how many seconds the token is valid for. The usePrismaticAuth hook is configured now to fetch a new token 30 seconds before the token expires. When a new token is detected, the useEffect within that hook re-issues a prismatic.authenticate() call with the new token.

taylorreece avatar Aug 07 '24 16:08 taylorreece