Question from a developer:
I'm getting a 190 BadRequest (or OAuthException) back in the details of an error response on a call to get the friends list or a friend leaderboard for one of my players. What can cause this?
Question from a developer:
I'm getting a 190 BadRequest (or OAuthException) back in the details of an error response on a call to get the friends list or a friend leaderboard for one of my players. What can cause this?
Ah, interesting! I was assuming you were using LoginWithFacebook to update the token. In general, the expectation is that you would use the Link calls to set associations for accounts, then log the player in using the Login calls. In reviewing the code, I do see that the Link logic simply returns an OK if the token submitted is for the Facebook account already linked to the PlayFab user account, but it doesn't update to that new token - I'll open a bug to get that changed, so that it does. In the meantime, you can fix this fairly easily by using the Login call, instead of the Link call in your flow.
That's great! Thanks!
Just to clarify @Brendan, the reason I am using Link, instead of just Login, is that in the case of someone who hasn't logged in with FB before, I assume calling LoginWithFacebook will create a new player for them (they are already logged in as a guest). So for every player who logs in with facebook, we end up with 2 accounts. One of which is probably not going to be used again.
On the other hand calling Link, leaves them with the same account, and doesn't waste the guest account.
So I am basically doing it so that I don't waste your servers.
You should use Link to attack the Facebook credentials to the account, yes. But the only way the Login call would create a new account is if you have CreateAccount set to true.
I need create account to be true because at this stage there is no way to know if they are linked already. Unless I go and get account info.
So any of these these would fix my problem. (in order of preference)
1) LinktoFacebook updates to the new token.
2) LoginResult tells me which accounts are connected
3) Result from Link tells me that it is already linked. Not ideal.
4) I just call Login if I get a 190. Pretty dirty.
The 190 error is coming back from Facebook. Basically, any call that requires us to get info from Facebook on the user's behalf requires a valid Facebook token. The token the client gets from Facebook is a short term token, meaning it's only valid for an hour or so (and Facebook could change that at any time, so don't count on it). We do have a backlog item for us to convert that to a long term token if the title has the Facebook app secret key configured in our service (required, for us to get the long term token), and we'll be addressing that later this year. But even with that, the Facebook token could expire or be revoked at any time, so this is a condition you need to watch out for. If you get this error, the way to handle it is to re-authenticate the player, using a Facebook token (LoginWithFacebook), so that our service can continue to make calls on the user's behalf.
So if i understand that right, if GetFriendsList for example fires the error delegate with the errorCode 190, u should call LoginWithFacebook from the FB SDK and retry GetFriendsList ?
Best regards
As a title who only uses the Facebook token for the GetFriendList and GetLeaderBoard calls, i should unlink my old facebook token and relink the new one ,since i dont call LoginWithFacebook ?
That confuses me.
In my title Facebook is optional, so i use LoginWithAndroidID for example to login.
Lets use that example:
Player A creates an Account, after that, he connects to Facebook and uses LinkFacebookAccount. Now he can use GetFriendsList and can get his Facebook friends.
He does the call and gets Error 190. Now i relogin with the Facebook SDK and get a NEW facebook token. When i use LoginWithFacebook and pass the new token, a new account will be created since that facebook token is not in use ? So i have to unlink the old token and relink the new one to the same playfabid, no ?
No, once a Facebook account has been linked to the player's account, any sign-in using a token for that Facebook account (specifically for that application) will result in using the existing PlayFab account. The Facebook token is not unique to the user - it is unique to the user + application + time period. So the same user on the same application would get a different token in an hour, but the resulting Facebook ID for that user on that application would always be the same. And that's what we use to get you to the right account.
That's actually one of the reasons we're specifically saying you should not unlink the account then re-link it. If your player loses connectivity (driving into a tunnel, etc.) after the unlink call, that Facebook account is no longer linked to a PlayFab account. If you were to use LoginWithFacebook at that point (with CreateAccount set to true), you would create a new PlayFab account, but only because you unlinked the Facebook account from the PlayFab account.
@Brendan I am getting this error just after linking to facebook.
This is my theory on why. Would be good if you could say if this could be what is going down.
I have a guest login, and then I do a fresh login to Facebook. On success it then links to facebook with that token. Then it is doing more calls and getting the 190 Bad Request.
So I think what is happening is that Playfab is saying Already Linked (which is true) and proceeding to ignore the fresh token that I just sent. It then continues to use the last one it got, which is stale.
Does that sound about right? If so, can you think of a better way to go about this? Or a way around it?
It would be great if the LoginResult told you what the account was linked to.
Thanks!
No one has followed this question yet.