Skip to content

Instantly share code, notes, and snippets.

@sideshowcoder
Created October 2, 2012 16:16
Show Gist options
  • Save sideshowcoder/3820532 to your computer and use it in GitHub Desktop.
Save sideshowcoder/3820532 to your computer and use it in GitHub Desktop.
ActiveResource with OAuth2
class ProtectedResource < ActiveResource::Base
# since the gateway uses oauth2 every call needs to be authenticated,
# so the token for is needed
class << self
attr_accessor :token_string
end
# setup the headers for oauth2
def self.headers
{ 'authorization' => "Bearer #{token_string}"}
end
end
@morion4000
Copy link

How do you set the token_string?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment