question

David James avatar image
David James asked

Headless Photon (Fusion) Server Startup Fails PlayFab Authentication

To start, this is not a CLIENT issue. I have read and re-read the photon authentication guide.
When starting a Headless server (running locally for debugging, NOT PlayFab's servers)-
I encounter this issue where I'm finding myself needing to authenticate a SERVER instance as if it were a client!

// Start the Server
server.StartGame(new StartGameArgs
{
SessionName = SessionID, GameMode = GameMode.Server, AuthValues = Authentication.Server,

}).ContinueWith(task =>{ Debug.Log(task.Result.Ok);});

. If AuthValues is left blank: Failed with reason : CustomAuthenticationFailed (AuthenticationType 'None' not supported)
. If AuthValues has only an initialized AuthenticationValues() with AuthType set to Custom:
Failed to parse token from request

If I'm meant to fill in the authentication for the server to start, what would I use as "user" for example in the AuthParamaters? Is there a server-specific PlayFabId I need to be using? And what about token?

I'm not sure what to do at this point, there is no clear indication if this is a bug or user-error..

Authenticationphoton
1 comment
10 |1200

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

David James avatar image David James commented ·

I have it down currently to using the Client API to create a player account for the server to use.. this feels dirty using Client API to create a Player account to start an authenticated photon server.. surely there is a better solution..?

1 Like 1 ·

1 Answer

·
Made Wang avatar image
Made Wang answered

You can call LoginWithServerCustomId on the server to log in, then call GetPhotonAuthenticationToken, and pass the SessionTicket returned by login as the parameter of AuthenticationContext.

In the common scenario, when players connect to a server, they need to upload their token for authentication. And referring to the examples in Fusion Headless Mode | Photon Engine, it seems that no authentication is required to start the server. I don't know Photon very well. I suggest you go to the Photon official forum for professional support.

1 comment
10 |1200

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

David James avatar image David James commented ·

Yes thank you- so LoginWithServerCustomId will give me some resemblance of a PlayFabID I will then use to authenticate.. and Yes, I know the doc you speak of it's what I'm basing my start on and it does not account for authentication. As I said when you try to start a server that is marked as authenticated it will not allow server to start without those ID/Token parameters.
Error being: "Custom Authentication Failed"

..which left me to sign in as a client, only now I can use the Server api instead so thank you sir! :)

I have raised this question in the discord a couple of times now during active hours, I'm not sure anyone really knows the answer frankly being that fusion is so new.
But regardless I'm content with this outcome thank you again.. I will try to suggest a hinting of this scenario to them since it's going to be common once people start rolling with fusion in combination with playfab.

0 Likes 0 ·

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.