The player is not authorized. Wait until authorized before attempting to link.

Hello, this is my first time using the unity authentication system. Here, I want to implement a player Facebook login system. First I am trying to register the user anonymously, then when the player clicks the Facebook login button, they will be signed into their account. I am using the Facebook current user access token to link the account, as described in the documentation. However, I get this error.

when I try to build and run it on my android mobile I get an error saying unable to validate token.

Note: I did create a Facebook app and added the app ID and secret in unity, also updated the hash key in the Facebook app.

My question is:
How do I solve this?
How can I enable players to log in using Facebook?
when I use SigninAnonymouslyAsync() what exactly happens? does the player also gets stored online?
And where can I see the players in the UGS dashboard?

I am attaching the code here. the code is a little bit unorganized right now as I am testing it.

7715944–967675–AuthPlayer.cs (8.28 KB)

Hi there,

So that I can help, with the Facebook login. Can I get a little more information?

  • What app type did you select in Facebook?
  • On Facebook, if you navigate to the Settings then Apps and Website, does your application show up?
  • Finally, when you are receiving the first error: “The player is not authorized. Wait until authorized before attempting to link”; is this in the Unity Editor or with a PC build?

When you use “SignInAnonymouslyAsync()” a random UUID is generated for the player. This UUID will stay for this player until they uninstall the game from their device. Note, this ID does not travel between devices as it is anonymous. When you use the “LinkWithFacebookAsync()”, the player’s Facebook account gets linked with this generated UUID. The generated UUID can be used with Cloud Save and Economy to have a look at their current inventory or the current data that is saved for them.

Currently, we do not have the tools to allow to you to see all the players in a list, but as mentioned before you can have a look at the details about player inventory and cloud save using the user id. You can retrieve the id from the Authentication SDK by using AuthenticationService.Instance.PlayerId.

  1. for facebook app I selected “gaming” app
  2. in facebook ‘apps and website’ my game does show up.
  3. error: “The player is not authorized. Wait until authorized before attempting to link”; show up in the android build.

here, is the error when I run the application on android device:

However, when I try to test it in the editor, the facebook does not work properly as it shows a dialog box to enter facebook account token. here, I use tokens retrieved directly from Facebook developer test accounts. When I do that it sometimes does seem to work. But not always.

what should I do?

Hello NIZ_DX

I believe the type of app should be “Consumer”

1 Like

switching the app to the “Consumer” type did fix the problem.
Thanks a lot.

1 Like