question

David James avatar image
David James asked

Server Authentication with LoginWithServerCustomId

HI, I made a post in the past asking how a server would login and authenticate itself as it's not a user, someone directed me to the LoginWithServerCustomId call which I'm using.

My question is, what would be the best way to assign an ID to a server to ensure two servers spun up aren't trying to login as the same "user"? Does it matter? Or can all servers use the same ID.
I don't think a random tag will be enough in the case of playfab requiring servers to have unique id's, is there anything playfab has, maybe using the current server process id as the login id? (if so, how would one get that id?)

Another concern would be that using the LoginWithServerCustomId Api actually counts towards unique users.
So if I understand that right, Servers count towards unique Players? So if I have many servers, I'm using up my unique player quota.. seems a bit odd.

Authenticationphotonmultiplayer
10 |1200

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

JayZuo avatar image
JayZuo answered

I'm afraid you have some misunderstandings of the LoginWithServerCustomId API.

LoginWithServerCustomId API is also used to authenticate players, just the same as LoginWithCustomId and other authentication APIs. The difference is that LoginWithServerCustomId should be called on server with developer security key. While other authentication APIs are called on client with no authorization header.

Then why we need such an authentication API on server? One common scenario is that your company has had an authentication system and you want to integrate your own authentication system with PlayFab. In this scenario, you can let your authentication system returns a UUID when the player is authenticated and create a new endpoint/API wraps your existing system like the following:


There is no need for a server to login or authenticate itself as server can use security key to perform any actions you need.


1zkan.png (110.1 KiB)
2 comments
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 ·

Hi @Jay Zuo thank you for your detailed explanation!

It looks like my problem stemmed from an earlier photon bug, and you're right of course servers shouldn't need to authenticate.. appreciate you!

0 Likes 0 ·
JayZuo avatar image JayZuo ♦ David James commented ·

Glad to know my answer helps. If you have any other questions on this, please feel free to let me know.

0 Likes 0 ·
justin-4 avatar image
justin-4 answered

@JayZuo Follow up question, once the client (in my case Unity app) gets the ServerLoginResult, are they "logged in" such that the app can use the PlayFab Unity SDK? Is there any example code of this loop?

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.