Created
August 3, 2013 09:56
-
-
Save codebrane/6145919 to your computer and use it in GitHub Desktop.
Setup Dropbox access from Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'dropbox_sdk' | |
APP_KEY = 'YOUR_APP_KEY' | |
APP_SECRET = 'YOUR_APP_SECRET' | |
flow = DropboxOAuth2FlowNoRedirect.new(APP_KEY, APP_SECRET) | |
authorize_url = flow.start() | |
puts '1. Go to: ' + authorize_url | |
puts '2. Click "Allow" (you might have to log in first)' | |
puts '3. Copy the authorization code' | |
print 'Enter the authorization code here: ' | |
code = gets.strip | |
access_token, user_id = flow.finish(code) | |
File.open('access_token', 'w') { |file| | |
file.write(access_token) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment