# authorizer/2.9.1/js/authorizer-login-custom_google.js

Authorizer, version 2.9.1. 30 lines.

- Page: https://pluginprobe.com/plugins/authorizer/2.9.1/code/js/authorizer-login-custom_google.js
- Raw: https://pluginprobe.com/plugins/authorizer/2.9.1/raw/js/authorizer-login-custom_google.js
- Modified: 2018-06-30T00:59:34+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/authorizer/2.9.1/code/js/authorizer-login-custom_google.js#L10-L20`.

```javascript
/**
 * Inserts the "Sign in with Google" button.
 */

/* global document, signInCallback, gapi */
( function() {
	var po = document.createElement( 'script' );
	po.type = 'text/javascript';
	po.async = true;
	po.src = 'https://plus.google.com/js/client:plusone.js?onload=render';
	var scr = document.getElementsByTagName( 'script' )[0];
	scr.parentNode.insertBefore( po, scr );
})();

/* Executed when the APIs finish loading */
// eslint-disable-next-line
function render() { // jshint ignore:line
	// Additional params including the callback, the rest of the params will
	// come from the page-level configuration.
	var additionalParams = {
		callback: signInCallback,
	};
	// Attach a click listener to a button to trigger the flow.
	var signinButton = document.getElementById( 'googleplus_button' );
	signinButton.addEventListener( 'click', function() {
		gapi.auth.signIn( additionalParams ); // Will use page level configuration
		jQuery( '#googleplus_button' ).animate({ opacity: 0.5 });
	});
}

```
