question

mahgo avatar image
mahgo asked

How to get PlayerId of player that is logged in with OpenId Connect

The users in my game are logged into Playfab via "

LoginWithOpenIdConnect". I'm wanting to work out what a user's PlayerId is in my server code so that I can post statistics etc for that player. How can I best achieve this?

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.

Citrus Yan avatar image Citrus Yan commented ·

Regarding server code, do you mean CloudScript?

0 Likes 0 ·
mahgo avatar image mahgo Citrus Yan commented ·

Ah I see I wasn't very clear about that. No, my game has a .net core server behind it, which will communicate with Playfab with the c# sdk.

0 Likes 0 ·

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

You can have the player send its SessionTicket returned from LoginWithOpenIdConnect to your .net core server and call Server/AuthenticateSessionTicket to authenticate & retrieve details about the user, then find its PlayerId in AuthenticateSessionTicketResult -> UserInfo -> PlayFabId(the same as PlayerId).

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.

mahgo avatar image mahgo commented ·

Thanks! I'll check that out!

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan mahgo commented ·

No problem, please let me know if you have any further questions.

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.