What is the best practice for persisting authentication in an HTML5 app? For example, in my app I am logging in via LoginWithEmail and storing the EntityTokenReponse in a cookie. Subsequent API calls after login work fine, but after the browser is refreshed the authentication state is lost in PlayFab(I see null values for properties in _internalSettings). What PlayFab interface(s) should I use to restore the auth state from the cookie values? Or am I missing some pieces here?
Thanks much
Answer by Hernando · May 17, 2019 at 06:25 AM
JavaScriptSDK does not support using cookies to store the player's authentication content, so the token will released from memory after closing tab. But there's nothing preventing you from doing it in your own client code, you could write custom logic to support as storing the authentication content in a cookie as you like.
Besides, in addition to storing the authentication content , don't forget checking the cookie and update _internalSettings before calling the login API of Playfab.
Unity SDK: How to result.toString() to show full results? 1 Answer
Testing LoginWithIOSDeviceID in Unity Remote 1 Answer
What is the FacebookInstantGamesSignature? 1 Answer
How can I get the iOS and Android DeviceID? 1 Answer
AddUsernamePassword requires both email and username while Other APIs do not? 1 Answer