Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Simple Google Sign-in

Discussion in 'Assets and Asset Store' started by hippogames, Aug 5, 2023.

  1. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    237
    Social.png
    Simple Google Sign-In provides Google sign-in with OAuth 2.0 for Android, iOS, Windows, Mac, Universal Windows Platform (UWP) and WebGL apps made with Unity.​

    Authentication may be a headache, especially for beginners, especially on different platforms. So I decided to take a fresh look of current possibilities that Google and Unity provide at the moment. And after a week of research I said "Bingo!". My asset is an extremely simple solution with about 200 lines of code only. Lightweight, tiny and clean, with no massive plugins and 3rd party libs!

    Benefits
    • Cross-platform user auth for cross-platform games and apps
    • No plugins, no 3rd party libs, no dependencies
    • No impact to build size
    • More security for client-server apps (get access token on a client, get all user data on a server to avoid tampering)
    • JSON Web Tokens (JWT) validation
    General workflow
    • Your app navigates users to Google using a default web browser
    • Users perform sign-in to their Google account
    • Google redirects users to your app (using deep linking when possible) and provides an authorization code in URI parameters
    • The app is activated and obtains an authorization code
    • The app exchanges the code for an access token
    • The app requests user data with the access token (ID, name, email and other data according access scope defined)
    Workflow for Windows, Mac and Editor
    Workflow for WebGL
    • Redirect to Authorization Middleware is used to temporary save an auth code
    • The app obtains the code from Authorization Middleware with a POST request
    Asset Store: http://u3d.as/32YE
    Wiki: https://github.com/hippogamesunity/SimpleGoogleSignIn/wiki

    Screenshot_1.png Screenshot_2.png Screenshot_3.png Screenshot_4.png
     
    Last edited: Sep 28, 2023
    Timmy-Hsu and sandolkakos like this.