question

giorgiotino avatar image
giorgiotino asked

How to test token errors?

Hi,

I am setting up third-party login on PlayFab for an app I am working on. I have included Apple SignIn, Google Play and Facebook as additional login methods, and I was able to login with all of them without problem. I receive the access tokens and I can link the PlayFab account.

Now, the problem is that I would like to test also the error scenarios to make sure that I am handling them properly. Unfortunately I haven't found a proper way to handle, say, expired tokens at login, as I can't find a way to make those tokens expire.

E.g. looks like Facebook tokens last 60 days and even if I change the Data Expiration for test accounts, the token expiration date is still the same.

Note that I will probably use those linked identities to let the players recover their playfab accounts, thus probably using the device Id 99.9% of times to retrieve the PlayFab account. This means that I won't probably use e.g. the FB calls too much...

I understand that this is probably a Facebook question, but I also wonder if anyone else tried to test those failure scenarios via PlayFab, and if so what did they do to handle them: is there a way to force PlayFab calls to fail in debug scenarios?

For example, I guess the LoginWithFacebookAccount will return some kind of token expired error if the token is expired, but what about the PlayFabManager.Instance.UserAccountInfo.FacebookInfo? Would it still be set to something NOT null even if the token expired?

I need a way to know when I have to ask the user to login again in order to refresh the token...

Thanks a lot for your help!

Player Datatest
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

Sorry, currently we don’t have a option to force PlayFab calls to fail in debug scenarios. However, for instance, in the case of the LoginWithFacebook API, it’ll return various error codes, each depicting the issue PlayFab is currently facing when error happens, you can use such info to handle each failure case and take additional actions when necessary. When the Facebook access token expires, UserAccountInfo.FacebookInfo won’t get returned, and, PlayFab should return the “InvalidFacebookToken” error which you need to properly handle by prompting the user to login again.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.