A module for integrating GAPI and Firebase into your Angular projects
npm install gapi-firebase-auth* Create a new Firebase and Google Apps project
* In your Firebase app, select Authentication->Signin Method->Google and turn on
* In the Google Dev console, create your credentials and API key (you can choose to restrict these if you want)
* Back in Firebase, under Web SDK settings in the Google Auth panel opened before, put your Google ClientID and Web Secret
* Add Firebase and AngularFire to your project
`` html`
* Inject firebase and Gapi into your Angular module
` javascript
angular.module('myApp', ['ngRoute', 'firebase', 'gapi-firebase-auth'])
`
* In the .run module, add this:
`javascript
.run(['coreAuthService', function(coreAuthService) {
//Array of discovery documents
coreAuthService.setDiscoveryDocuments(['https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest', 'https://www.googleapis.com/discovery/v1/apis/gmail/v1/rest']);
//You can add other discovery documents using the discovery service: https://developers.google.com/discovery/v1/reference/apis/list#try-it
coreAuthService.setClientId('google-client-id');
coreAuthService.setApiKey('google-api-key');
//Set your scopes - the basic Auth ones are already set for you in coreAuthService
coreAuthService.setScopes('https://www.googleapis.com/auth/calendar.readonly https://www.googleapis.com/auth/gmail.readonly');
//Run the main initialiser - Clients load automatically
coreAuthService.initiateGapi();
}]);
``