Hello, is it possible to Login player with google account, and with ServerAuthCode?
or
Execute cloud script when player is not logged in? And we would like to create our own login.
Hello, is it possible to Login player with google account, and with ServerAuthCode?
or
Execute cloud script when player is not logged in? And we would like to create our own login.
Today I've posted new instructions on how to setup google play signin
https://api.playfab.com/docs/tutorials/landing-players/sign-in-with-google
If you are unable to get the Auth Code from GPG, then check the following.
1> You have added the .GetServerAuthCode(false) to the builder
2> You are added to your google services as a tester
3> That you have the correct "resources" file (refer to the document above)
Thanks for updated manual. What helped me is adding BOTH Android and Web to Game Services.
To log in with a Google account, you would use LoginWithGoogleAccount, passing us the user's token.
Cloud Script was designed to be run in response to requests from the Client, though we will be providing a way to schedule Cloud Script calls for Segments in PlayStream shortly.
Could you clarify what you mean when you say you want to create your own login? For example, do you mean you have your own OIDC login system, and you want to use a token from it to sign into PlayFab?
Hi, actually there is second type of google token. Server Auth Code. Something like this...
platform.GetServerAuthCode((status, authCode) => { if (authCode != null) { // this should be success lts = LoginTryState.Success; serverAuthCode = authCode; } else { if (status == CommonStatusCodes.Canceled || status == CommonStatusCodes.Interrupted || status == CommonStatusCodes.SignInRequired) { lts = LoginTryState.Failed; } else { lts = LoginTryState.Offline; } } Debug.Log("[BackEndManager] " + status + " Auth Code: " + authCode); });
Which can be exchanged for access token via https://accounts.google.com/o/oauth2/token. This token is returned by google game services plugin for unity. If you want to get the access token, another set of consent dialogs opens. Which if user denies access you are left logged in into game services but not in playfab(because token is missing).
We had to modify this plugin so its possible to add another permissions to initial login request. The only problem is we have to have external service for exchanging auth code for access token. If play fab would allow to have cloud scripts which can be executed by non authenticated users there would be no need to this type of external custom service. Exchange has to be done on external part because you need to make request to google with client_secret.
Just making sure all the other threads on this topic have the updated info: We do now support the newer Google authentication (ServerAuthCode) process. Please see this post for more information: https://playfab.com/blog/setting-up-google-sign-in/.
Hi, the code that mentioned in article (https://blog.playfab.com/blog/setting-up-google-sign-in) is obsolete. I downloaded latest Google Play Games Plugin 0.9.39a. So far code has to be like this. But Auth code is always empty.
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().AddOauthScope("profile").Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.DebugLogEnabled = true; PlayGamesPlatform.Activate(); Social.localUser.Authenticate((success) => { if(success) { Debug.Log("Auth was a success!"); try { string AuthCode = PlayGamesPlatform.Instance.GetServerAuthCode(); Debug.LogFormat("AuthCode: {0}", AuthCode); }catch(System.Exception e) { Debug.Log("Error Getting Id Token: " + e.Message); } } else { Debug.Log("False"); } });
This tutorial is our current documentation on the sign-in process using Google (https://api.playfab.com/docs/tutorials/landing-players/sign-in-with-google). Can you try using it and see if that helps?
This doc was the first I read. Code is not working, they changed function GetServerAuthCode(), it no longer accepts arguments. I changed code on what I think it should be but it is not working. Tried it on empty Unity project. OAuth tried both: as Android and as web-app.
2> We have updated the official document located here: https://api.playfab.com/docs/tutorials/landing-players/sign-in-with-google and provided a video. Granted the audio is broken, and I am working to make a new video where the audio is working. Might take me a few days to get to it though.
4 People are following this question.