
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
angular-google-gapi
Advanced tools
An AngularJS module for use all Google Apis and your Google Cloud Endpoints (Google App Engine) with OAuth. This module use Google APIs Client Library for JavaScript, available for all GApis.
An AngularJS module for use all Google Apis and your Google Cloud Endpoints (Google App Engine) with OAuth. This module use Google APIs Client Library for JavaScript, available for all GApis.
An example is executed here : http://maximepvrt.github.io/angular-google-gapi/
The code is available here : https://github.com/maximepvrt/angular-google-gapi/tree/gh-pages
This module is available as bower package, install it with this command:
bower install angular-google-gapi
or you may download the latest release
<script type="text/javascript" src="vendors/angular-google-gapi.min.js"></script>
var app = angular.module('myModule', ['angular-google-gapi']);
add run in root module
app.run(['GApi', 'GAuth',
function(GApi, GAuth) {
var BASE = 'https://myGoogleAppEngine.appspot.com/_ah/api';
GApi.load('myApiName','v1',BASE);
GApi.load('calendar','v3'); // for google api (https://developers.google.com/apis-explorer/)
GAuth.setScope("https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/calendar.readonly"); // default scope is only https://www.googleapis.com/auth/userinfo.email
}
]);
add run in root module
app.run(['GAuth', 'GApi', '$state',
function(GAuth, GApi, $state) {
var CLIENT = 'yourGoogleAuthAPIKey';
var BASE = 'https://myGoogleAppEngine.appspot.com/_ah/api';
GApi.load('myApiName','v1',BASE);
GAuth.setClient(CLIENT);
GAuth.checkAuth().then(
function () {
$state.go('webapp.home'); // an example of action if it's possible to
// authenticate user at startup of the application
},
function() {
$state.go('login'); // an example of action if it's impossible to
// authenticate user at startup of the application
}
);
}
app.controller('myController', ['$scope', 'GApi',
function myController($scope, GApi) {
GApi.execute('youApi', 'you.api.method.name').then( function(resp) {
$scope.value = resp;
}, function() {
console.log("error :(");
});
}
]);
app.controller('myController', ['$scope', 'GApi',
function myController($scope, GApi) {
GApi.execute('youApi', 'you.api.method.name', {parm1: value}).then( function(resp) {
$scope.value = resp;
}, function() {
console.log("error :(");
});
}
]);
app.controller('myController', ['$scope', 'GApi',
function myController($scope, GApi) {
GApi.executeAuth('youApi', 'you.api.method.name').then( function(resp) {
$scope.value = resp;
}, function() {
console.log("error :(");
});
}
]);
app.controller('myController', ['$scope', 'GApi',
function myController($scope, GApi) {
GApi.executeAuth('youApi', 'you.api.method.name', {parm1: value}).then( function(resp) {
$scope.value = resp;
}, function() {
console.log("error :(");
});
}
]);
app.controller('myController', ['$scope', 'GAuth', '$state',
function myController($scope, GAuth, $state) {
$scope.doSingup = function() {
GAuth.login().then(function(){
$state.go('webapp.home'); // action after the user have validated that
// your application can access their Google account.
}, function() {
console.log('login fail');
});
};
}
]);
Get user info after login is very simple.
app.controller('myController', ['$rootScope',
function myController($rootScope) {
console.log($rootScope.gapi.user)
}
]);
<h1>{{gapi.user.name}}</h1>
User object :
FAQs
An AngularJS module for using all Google Apis and your Google Cloud Endpoints (Google App Engine) with OAuth. This module uses Google APIs Client Library for JavaScript, available for all GApis.
The npm package angular-google-gapi receives a total of 15 weekly downloads. As such, angular-google-gapi popularity was classified as not popular.
We found that angular-google-gapi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.