Giter Site home page Giter Site logo

vpriya95 / google-api-firebase-boilerplate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vanderlin/google-api-firebase-boilerplate

0.0 0.0 0.0 18 KB

Google API and Firebase Auth

Home Page: https://google-api-firebase.herokuapp.com

JavaScript 75.53% HTML 0.96% Vue 20.92% CSS 2.58%

google-api-firebase-boilerplate's Introduction

Google API + Firebase - Boilerplate

Setup Configuration

copy the example-config.js and save it as config.js in the same location.

Firebase Config

From overview , click add Firebase to your web app and copy those value under firebase: {...}

Google API Config

from https://console.developers.google.com you need to enable a few APIs. Click Enable API, from the list add Google Calendar API and Google+ API. You can add anything you want, just make sure to add it to the discovery_docs array if you would like to access with in your app.

Under Credentials, click Create credentials -> API Key. add this to google in the config.js file. If there is not already a OAuth 2.0 client IDs create one from the Create credentials drop down. Click the pencil and copy over the Client ID to the config.js file.

You can add a hosted_domain making it so that only people from a given domain that use google can app your app. ie: biz.com.

You need to add the scope for any of the APIs that you added, in this example we are using google+ and the calendar. You can see more scopes here: https://developers.google.com/identity/protocols/googlescopes

We need to add the discovery_docs that we need people and calendar. To add more view here: https://developers.google.com/discovery/v1/getting_started

module.exports = {
	google: {
		client_id: '****.apps.googleusercontent.com',	
		api_key: '****',
		hosted_domain: '****.com',
		scope: 'profile email https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/plus.login',
		discovery_docs: [	      
			'https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest', 
			'https://people.googleapis.com/$discovery/rest?version=v1'
		],
	},
	firebase: {
		apiKey: '****',
		authDomain: '****.firebaseapp.com',
		databaseURL: 'https://****.firebaseio.com',
		storageBucket: '****.appspot.com',
		messagingSenderId: '****'
	}
}

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

Deploy & Authorization

This app is ready to deploy to heroku just add from github (with a config.js file) or from the heroku toolbelt. We ignore the config.js so we need to force add this if we want to keep it out of our Github repo. There are many ways to do this, but here is one solution.

Create an app in the Heroku dashboard.

Login to heroku with the heroku toolbelt. heroku login

Add the remote heroku git:remote -a {your-app-name}

Authorize domain. In the Google console under the OAuth 2.0 Client IDs you need to add the heroku domain to Authorized JavaScript origins and Authorized redirect URIs, then click save. This may take a few minutes to take affect.

# create a deploy branch that we do not track on heroku
git branch deploy
git checkout deploy

# add everything and force add the config.js file
git add .
git add src/config.js -f 

# commit and push deploy to heroku 
git commit -am "Deploy to heroku!"
git push heroku deploy:master

google-api-firebase-boilerplate's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.