Recent projects to access Google's login. Tell me about the hole you've stepped on.
The first time access to Google's login SDK, online search for half a day. Find yourself searching for the wrong keywords. I've been searching the internet for Google sign-in. The results have been searched for all of the articles are Android access methods.
As a result I exported Android projects from Unity and followed the online approach. it turned out to be impossible!
Google sign-up for unity access in the next page
Unity access to Google Login website access documents (not FQ can also be opened): Https://github.com/playgameservices/play-games-plugin-for-unity
Click Current-build to download Googleplaygamesplugin-**.unitypackage
You can import the Unity project by double clicking on the downloaded file.
Toggle Unity Project for Android platform (File->build Setting->android->switch platform)
Add down click on the Window->google Play games->setup->android Setup ..., (operation as) in the Unity menu
You can open the following interface:
The next step is to fill in the 2 red-framed sections.
The first red box that you fill in is actually the achievement information for the app you're applying for in Google.
The second red box (that is, client ID) is filled in with the customer ID of the Web client (Web client) in the Project OAuth 2.0 client ID in Google APIs (this is especially important to note that the ID of the Web client must be filled out, otherwise it will not work)
When you are finished, click the Setup button to complete the setup.
The next step is to write the login code in unity.
Staticplaygamesclientconfiguration config =NewPlaygamesclientconfiguration.builder (). Enablesavedgames (). Requestemail (). Requestserverauthcode (false) . Requestidtoken (). Build (); Public voidSignIn () {playgamesplatform.initializeinstance (config); Playgamesplatform.debuglogenabled=true; Playgamesplatform.activate (); Social.Active.localUser.Authenticate ((BOOLSuccess) ={ if(Success) {Debug.Log ("UserName:"+((Playgameslocaluser) social.localuser). UserName); Debug.Log ("Login Successful"); Emailstr=((Playgameslocaluser) social.localuser). Email; Tokenstr=((Playgameslocaluser) social.localuser). Getidtoken (); } Else{Debug.Log ("Logon Failure"); } }); }
Google Login Access Unity