Last active
December 11, 2015 23:18
-
-
Save frnsys/4675887 to your computer and use it in GitHub Desktop.
Sessions controller for Google Reader APi
This file contains hidden or 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 'oauth2' | |
class SessionsController < ApplicationController | |
def create | |
# Get data back from OmniAuth | |
@auth = request.env["omniauth.auth"] | |
@token = @auth["credentials"]["token"] | |
# Create an OAuth2 client and access token, | |
# which we will use to access the API. | |
@client = OAuth2::Client.new(AUTH_CONFIG["client_id"], AUTH_CONFIG["client_secret"], :site => "https://www.google.com/reader/") | |
@access_token = OAuth2::AccessToken.new(@client, @token) | |
# Gets the contents of the authenticated user's stream | |
# and prints to console | |
puts @access_token.get("api/0/stream/contents/").body | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment