This repository has been archived by the owner on Sep 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Setting up OAuth & Deploying
nonword edited this page Nov 3, 2015
·
8 revisions
Obtain Google auth Client ID and Client Secret:
- Log in to https://console.developers.google.com
- Create a new Project if necessary
- Select APIs & auth > APIs
- Enable "Google+ API" and "Contacts API"
- Select APIs & auth > Credentials
- Under OAuth, Create a new Client ID
- Enter authorized URIs, e.g.:
Authorized JavaScript Origins: http://localhost:3000/
Authorized redirect URIs: http://localhost:3000/users/auth/google_oauth2/callback
- In your app root, create an .env with:
export GOOGLE_ID=*********************************************.apps.googleusercontent.com
export GOOGLE_SECRET=************************
- Go to https://developers.facebook.com
- Select "My Apps" > "Add a new app"
- Enter an app name (e.g. 'Scribe')
- Select 'Website' for app type
- Enter your Site URL (e.g. http://localhost:3000 for testing)
- Ignore all that noise about js integration
- Reload page so that you can select "My Apps" > [app name]
- Click "Settings" in sidebar and add a Contact Email
- Click "Status & Review" in sidebar and make it public (At writing, prompt is "Do you want to make this app and all its live features available to the general public?")
- Maybe add an app icon under "App Details", as this is what the user will see when logging in.
- Click 'Advanced' tab and add http://[domain]/users/auth/facebook/callback to "Valid OAuth redirect URIs"
- Save keys in your
.env
, e.g.:
export FACEBOOK_ID=817972851652302
export FACEBOOK_SECRET=********************************
TODO: NOTE this is currently not working. Get 422 Unprocessable Entity when attempting to log in.
- Log in at https://panoptes.zooniverse.org/oauth/applications
- You should see "Your applications" and a "New Application" link. If you do not, contact Zooniverse (TODO: contact info?).
- Click 'New Application' and enter a Name (e.g. 'Scribe') and your dev and prod URIs, e.g.
http://localhost:3000/users/auth/zooniverse/callback
http://emigrantbank.herokuapp.com/users/auth/zooniverse/callback
- Select 'User' Application Scope
- Click 'Submit'
- Save keys in your
.env
, e.g.:
export ZOONIVERSE_ID=d48226eb4c5e74************************************************
export ZOONIVERSE_SECRET=**********************************************
- Before starting app, run:
source .env
rails s
- Browse to http://localhost:3000
- Create an account at http://heroku.com
- Install heroku-toolbelt:
brew install heroku-toolbelt
- In your app folder, create the heroku app, e.g.:
heroku apps:create emigrantbank
- Register heroku remote, e.g.:
heroku git:remote --app emigrantbank
- Create a compose.io mongodb instance at https://compose.io
- Add a user (e.g. 'scribe-emigrantbank-user', '**********')
- Register db creds in heroku env, e.g.:
heroku config:set "MONGOLAB_URI=mongodb://scribe-emigrantbank-user:***************@dogen.mongohq.com:10082/scribe-emigrantbank"
- Save all of your OAUTH keys to the Heroku env:
heroku config:set "GOOGLE_ID=*********************************************.apps.googleusercontent.com"
heroku config:set "GOOGLE_SECRET=************************"
heroku config:set "FACEBOOK_ID=817972851652302"
heroku config:set "FACEBOOK_SECRET=********************************"
heroku config:set "ZOONIVERSE_ID=d48226eb4c5e74************************************************"
heroku config:set "ZOONIVERSE_SECRET=**********************************************"
- Allow browserify to work with this one weird trick
heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
- Push code:
git push heroku master
- Getting Started
-
Setting up your Project
- Setup Your Environment
- Configure your project
- Load your project
- Code & Technical Notes
- Project Reference