5 Steps to use Google Sign-In for Websites

Interesting video about this - https://www.youtube.com/watch?v=Oy5F9h5JqEU

Todays infomation is from google’s guides

  1. Create authorization credentials
    1.1 Go to the Credentials page - https://console.developers.google.com/apis/credentials
    1.2 Click Create credentials > OAuth client ID.
    1.3 Select the Web application application type.
    1.4 Name your OAuth 2.0 client and click Create

  2. Load the Google Platform Library

  3. Specify your app’s client ID

    Or you can also specify your app’s client ID with the client_id parameter of the gapi.auth2.init() method.

  4. Add a Google Sign-In button

  5. Get profile information

    1
    2
    3
    4
    5
    6
    7
    function onSignIn(googleUser) {
    var profile = googleUser.getBasicProfile();
    console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
    console.log('Name: ' + profile.getName());
    console.log('Image URL: ' + profile.getImageUrl());
    console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
    }

More info here - https://developers.google.com/identity/sign-in/web/sign-in