OAuth DevTools
This app provides a set of OAuth development tools.
It includes a web server app that performs OAuth 2.0 with services and then writes the retrieved access token to the file system in a dotenv .env file so that it can be easily used by applications during development. Code in the scripts directory use the .env file to perform example tasks.
Benefits
This is beneficial because some services only support 3-legged OAuth which requires a webserver and redirection. In development mode, some of these services recommend generating an access token via a webpage and copy / pasting that into an app which can be cumbersome so this app streamlines this process.
- Eliminates need to copy and paste access token in development by storing the access token in a program accessible file system location
- Provides example code for production OAuth with redirection when some SDK tutorials do not
Integrations
Currently, only Dropbox is supported, but as services are added, each will have information prefixed by the service name.
Supported services include:
| Service | Input Variables | Output Variables |
|---|---|---|
| Dropbox | DROPBOX_APP_KEY, DROPBOX_APP_SECRET, DROPBOX_OAUTH2_REDIRECT_URI |
DROPBOX_ACCESS_TOKEN |
Prerequisites ⚠️
Installation
Install Bundler if necessary:
$ gem install bundlerInstall app and required gems:
$ git clone https://github.com/grokify/oauth-devtools
$ cd oauth-devtools
$ bundle installConfiguration
Ensure you are in the oauth-devtools/app directory and then create / edit the .env file. Ensure that your OAuth redirect URI matches the one specified in your app configuration page.
$ cd app
$ cp sample.env.txt .env
$ vim .envUsage
Ensure you are in the oauth-devtools/app directory and then run app.rb.
$ cd oauth-devtools/app
$ ruby app.rbThen navigate your browser to the URL presented, e.g. http://localhost:4567.
Notes
This project is adapted from the example code for OAuth 2.0 authorization code grant in the RingCentral Ruby SDK.
Links
Dropbox Ruby tutorial
Contributing
- Fork it ( http://github.com/grokify/oauth-devtools/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
License
OAuth DevTools is available under an MIT-style license. See LICENSE.txt for details.
OAuth DevTools © 2015-2016 by John Wang