Skip to content

Instantly share code, notes, and snippets.

@andresbravog
Last active August 29, 2015 14:09
Show Gist options
  • Save andresbravog/f92229adb87c5d9d70a8 to your computer and use it in GitHub Desktop.
Save andresbravog/f92229adb87c5d9d70a8 to your computer and use it in GitHub Desktop.
Redbooth punchcard

Setting up the repo and app

> rails new redbooth-punch-card
> cd redbooth-punch-card
> git init .
> git add -A .
> git ci -m 'initial commit'
> git remote add origin git@github.com:andresbravog/redbooth-punch-card.git
> git push -u origin master

Adding rvm needs and .envrc (direnv)

> rvm rvmrc create ruby-2.1.4@redbooth-punch-card
> rvm rvmrc load .rvmrc
> vim .envrc
# .envrc
export SESSION_KEY=alksdfjaklsdfjalksjdfaue12312jadskfadfas231
> direnv allow .

Making the app little bit more secure

> vim config/initializers/session_store.rb
# config/initializers/session_store.rb
Rails.application.config.session_store :cookie_store, key: ENV['SESSION_KEY'] || '_redbooth-punch-card_session'

Adding devise

> vim Gemfile
# Authentication
gem 'devise'
> bundle
> be rails generate devise:install
> be rails generate devise User
> be rake db:migrate

Adding Omniauth and Redbooth-Omniauth

> vim Gemfile
# Gemfile
gem 'omniauth-redbooth'
> bundle
> bundle exec rails g migration AddOmniauthColumnsToUsers provider uid
> bundle exec rake db:migrate

Follow the instructions here to create a Redbooth oauth2 App. Be sure to Add the correct list of redirect-uri, in this case your callback uri will look like http://yourappdoma.in/users/auth/redboooth/callback.

https://redbooth.com/api/getting-started/

Follow the intructions here to complete a signup with Redbooth process with devise

https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment