Skip to content

Instantly share code, notes, and snippets.

@jdjkelly
Last active December 11, 2015 16:08
Show Gist options
  • Save jdjkelly/4625106 to your computer and use it in GitHub Desktop.
Save jdjkelly/4625106 to your computer and use it in GitHub Desktop.
Demonstrates a strategy for refreshing an access token using an OmniAuth provider class inherited from OAuth2
client = OmniAuth::Strategies::Windowslive.new( nil, windowslive_app_id, windowslive_app_consumer_secret).client
@access_token = OAuth2::AccessToken.new(client, refresh_token)
@access_token.refresh!
# Example API endpoint request
api_request_url = "https://apis.live.net/v5.0/me/contacts"
access_token.request(:get, api_request_url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment