This app is an example of OAuth 2 client. It was built in order to test the doorkeeper provider example. It uses oauth2 and sinatra gems. Check out the live app here. The source code is, as always, available on GitHub.
First clone the repository from GitHub:
git clone git://github.com/applicake/doorkeeper-sinatra-client.git
Install all dependencies with:
If you have your own provider or you are using this example, you'll need to create a new client for this application. Make sure to append the
/callback to the
redirect uri (e.g.
You need to setup few environment variables in order to make the client work. You can either set the variables in you environment:
export OAUTH2_CLIENT_ID = "129477f..." export OAUTH2_CLIENT_SECRET = "c1eec90..." export OAUTH2_CLIENT_REDIRECT_URI = "http://localhost:9393/callback"
or set them in a file named
env.rb in the app's root. This file is loaded automatically by the app.
# env.rb ENV['OAUTH2_CLIENT_ID'] = "129477f..." ENV['OAUTH2_CLIENT_SECRET'] = "c1eec90..." ENV['OAUTH2_CLIENT_REDIRECT_URI'] = "http://localhost:9393/callback"
Fire up the server with: