Skip to content

Instantly share code, notes, and snippets.

View syeduzairshah's full-sized avatar

Uzair Ahmed syeduzairshah

View GitHub Profile
@syeduzairshah
syeduzairshah / Angular Factory for Google SSO
Last active January 3, 2019 08:43
Inject this module in your application and you can use Google Factory for Google authentication, accessing access token and user profile
(function(){
angular.module('googleSsoApp', []).factory("Google",['$http', '$q', function ($http, $q) {
var currentWindowUrl = location.protocol + '//' + location.host + location.pathname;
var accessType = 'offline';
var state = encodeURIComponent(currentWindowUrl);
var responseType = 'code';
var scope = 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email'
return{
authenticate: function(clientId, redirectUri){