---
# System prepended metadata

title: Google Singin

---

# Google SignIn options and SingUp/SignIn sequence diagrams
 
These are the best approaches I found for each device. 

## Android

For android, we can use Google Play Games Service and GoogleSignIn plugin. This allows us to integrate SingIn to our game and even more. Tracking of the players, achievements and more.

Links for GoogleSignIn plugin are explained in the iOS build since it work for both plataforms.

### Requirements
Google Play Games Console: https://play.google.com/intl/es/console/about/

OAuth: To authenticate and authorize the players. We can use Google Cloud Console to create this credentials.


Unity package: https://github.com/playgameservices/play-games-plugin-for-unity

#### Links: 

+ Service: https://developers.google.com/games/services?hl=es-419
+ How to configure the Service: https://developers.google.com/games/services/console/enabling?hl=es-419
+ UGS: https://docs.unity.com/ugs/en-us/manual/authentication/manual/platform-signin-google-play-games


## IOS

We can use Google External Dependency Manager for Unity. With this package, we can add directly to our project the https://cocoapods.org/ dependency. Allowing us to use the GoogleSingIn Package.

### Requirements
Google External Dependency Manager for Unity: https://github.com/googlesamples/unity-jar-resolver

OAuth: To authenticate and authorize the players. We can use the Google Cloud Console to create these credentials.

GoogleSingIn: https://cocoapods.org/pods/GoogleSignIn

#### Links: 

+ How to add google SingIn for IOS https://developers.google.com/identity/sign-in/ios/start-integrating?hl=es-419

+ Usefull package: https://github.com/googlesamples/google-signin-unity


## Further Explanations

### Tokens:

When a returning or new player logs into your app, Unity Authentication generates the following tokens and ID:

+ A PlayerID (a random alphanumeric string of 28 characters): used to identify returning and new players on different devices and external providers.
+ A session token: used to re-authenticate the user after the session expires.
+ An authentication token: contains the PlayerID, and is used to prevent anyone from overriding the identification.


### SingUp Sequence
![Captura de pantalla 2024-01-09 a la(s) 12.44.42](https://hackmd.io/_uploads/HJbANNjOp.png)

### SingIn Sequence
![Captura de pantalla 2024-01-09 a la(s) 15.32.45](https://hackmd.io/_uploads/SkbRV4idp.png)


