Skip to content

Instantly share code, notes, and snippets.

@hayduke19us
Created October 3, 2013 16:43
Show Gist options
  • Save hayduke19us/6812953 to your computer and use it in GitHub Desktop.
Save hayduke19us/6812953 to your computer and use it in GitHub Desktop.
class SessionsController < ApplicationController
def index
if current_user
token = current_user.access_token
secret = current_user.access_secret
#for browsing the info
filename = '.access_token.yml'
File.open filename, 'w' do |f|
f.write token
f.write secret
f.close
end
end
rdio = Rdio::SimpleRdio.new([Figaro.env.omniauth_consumer_key, Figaro.env.omniauth_consumer_secret],
[token, secret])
#calls to rdio --->
#playlists rdio.call('getPlaylists')['result']['owned']
end
def create
user = User.from_omniauth(env["omniauth.auth"])
session[:user_id] = user.id
redirect_to root_url
end
def destroy
session[:user_id] = nil
redirect_to root_url
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment