Angular Google Plus Sign-in Button Directive
A good starting place for a Google Plus sign-in button. Specify your client id and you're done. Well, almost. You'll also want a signinCallback()
function so you can do something once your users are authenticated.
Usage
- Include
google-plus-signin.js
. - Add
directive.g+signin
as a dependency to your app. - Add
<g+signin clientid="your-client-id">
to your app. - Create a
signinCallback()
function to detect when your users are authenticated.
Example
See the homepage for an example.
<div ng-app="directive.g+signin">
<g+signin clientid="620125449078"></g+signin>
<p>^ This is a Google Plus sign-in button</p>
</div>
// Callback for Google+ Sign-In
function signinCallback(authResult) {
console.log(authResult);
if (authResult['access_token']) {
// User successfully authorized the G+ App!
} else if (authResult['error']) {
// User has not authorized the G+ App!
}
}
License
โก CopyHeart 2013 by Jerad Bitner | Copying is an act of love. Please copy.