Google OAuth
Hello
by sonicblis
HTML
<script src="https://apis.google.com/js/platform.js"></script>
<meta name="google-signin-client_id" content="fakeid.apps.googleusercontent.com">
<div ng-app="angularApp" ng-controller="appController">
<button ng-click="showGoogleButton()">Show Google Log In</button>
<div ng-include="googleButtonContainer"></div>
<script type='text/ng-template' id='googleButton'>
<div id="googleButtonPlaceholder"></div>
Sign in button should be above this
</script>
</div>
CSS
body{
font-family: verdana;
font-size: 10pt;
}
.clickable{
cursor: pointer;
}
JavaScript
var app = angular.module("angularApp", []);
app.controller("appController", ['$scope', '$window', '$timeout', function($scope, $window, $timeout){
$scope.showGoogleButton = function(){
$scope.googleButtonContainer = 'googleButton';
$timeout(function(){
$window.gapi.signin2.render('googleButtonPlaceholder', {
'scope': 'https://www.googleapis.com/auth/plus.login',
'width': 200,
'height': 50,
'longtitle': true,
'theme': 'dark',
'onsuccess': $scope.federateWithGoogle
});
});
};
$scope.federateWithGoogle = function(googleAuthInfo){
};
}]);