Google Sign in
If you’re developing on a project and you don’t want to deal with usernames or passwords Google OAuth2 is a great api to look into. I’ll explain the potential positives and negatives of using Google Sign for use in client-side apps.
Before you can get started using this api you need to setup a developers project and a client ID. The client ID we will get into more later. Google’s platform.js library contains functionality to give a class to div that will make the div a button loaded with all the needed functionality to allow a user of your app to sign in to google.
<script src="https://apis.google.com/js/platform.js" async defer></script>
After setting up your developer project with google you’ll get a client ID specific to your project. Insert your client ID into the a meta tag like below.
<meta name="google-signin-client_id" content="ENTIRE_ID_HERE">
Below is a div with the class made available from you html tags above to get those interested started.
<div class="g-signin2" data-onsuccess="onSignIn"></div>
The positives I noticed in my experience with google sign in were
- ease of use
- decent docs supporting it
- not directing handling sensitive user data
- small amount of code
- access to useful user data
The negatives I noticed were:
- a sense of unknown with how the button works
- scarce documentation of helper functions
- scare documentation on specifics for getting more creative with api
Google hiding their delicious code is somewhat understandable I suppose. I overall enjoyed the ease of use through google’s api. If you want to dive deeper into Google OAuth2 I suggest starting here: