Clef example Sinatra app setup -- demo:
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
lib
public/css
routes
views
.gitignore
Gemfile
Gemfile.lock
Readme.md
config.ru
tryclef.rb

Readme.md

Clef example Sinatra app

No backend, users are stored in memory so you can plug in your favourite backend

code from the dafult docs: http://docs.getclef.com/v1.0/docs/sinatra and from the example repo: https://github.com/clef/sample-ruby - https://github.com/clef/sample-ruby/blob/master/app.rb

Setup

Set up and configure an app on Clef: https://getclef.com/team/applications

Set up the config/clef.rb file

cp ./config/clef.rb.default ./config/clef.rb

vim ./config/clef.rb

and set both the client ID and SECRET.

then...

Install the dependencies:

bundle

Run it!

rackup

then connect to http://localhost:9292

Deployment

Rembember to change the session secret (:session_secret) in tryclef.rb

Use heroku / dokku / passenger / puma / thin/unicorn on nginx or whatever you want

TODO:

  • refactor clef_hook
  • move all the login/logout/user routes in lib
  • implement logout check / hook