Skip to content

Instantly share code, notes, and snippets.

@buntine
Last active August 29, 2015 13:56
Show Gist options
  • Save buntine/9151907 to your computer and use it in GitHub Desktop.
Save buntine/9151907 to your computer and use it in GitHub Desktop.
class TestsController < ApplicationController
def index
@callback_url = "http://127.0.0.1:3000/tests/callback"
@consumer = OAuth::Consumer.new("YOUR_APP_KEY","YOUR_APP_SECRET", :authorize_url => "http://www.discogs.com/oauth/authorize", :site => "http://api.discogs.com")
@request_token = @consumer.get_request_token(:oauth_callback => @callback_url)
session[:request_token] = @request_token
redirect_to @request_token.authorize_url(:oauth_callback => @callback_url)
end
def callback
@request_token = session[:request_token]
@access_token = @request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])
send_data @access_token.get("/image/R-150-3492040-1332527654.jpeg").body, :disposition => "inline", :type => "image/jpeg"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment