Last active
January 2, 2016 18:39
-
-
Save xenda/8345360 to your computer and use it in GitHub Desktop.
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
provider :twitter, '4sOviqvHXhvmLXHivZvWKw', '9kluWJlu3V25yAmFvFuxMmSDbt3SNzXhFZUelOoA3VA' |
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
session["current_user"] = request.env["omniauth.auth"]["uid"] | |
provider = request.env["omniauth.auth"]["provider"] | |
token = request.env["omniauth.auth"]["credentials"]["token"] | |
secret = request.env["omniauth.auth"]["credentials"]["secret"] | |
if provider =~ /twitter/ | |
logger.info token | |
logger.info secret | |
twitter = Twitter::REST::Client.new do |config| | |
config.consumer_key = '4sOviqvHXhvmLXHivZvWKw' | |
config.consumer_secret = '9kluWJlu3V25yAmFvFuxMmSDbt3SNzXhFZUelOoA3VA' | |
config.access_token = token | |
config.access_token_secret = access | |
end | |
#twitter = Twitter::Client.new(oauth_token: token, oauth_token_secret: secret) | |
twitter.update("OMG IT WORKS ;_;") | |
session["name"] = request.env["omniauth.auth"]["info"]["name"] | |
session["image"] = request.env["omniauth.auth"]["info"]["image"] | |
elsif provider =~ /github/ | |
#Octokit.new.. | |
else | |
# Koala.new(token, secret) | |
end | |
# uid = request.env["omniauth.auth"]["uid"] | |
# provider = request.env["omniauth.auth"]["provider"] | |
# user = User.find_or_create_by_uid_and_provider(uid, provider) | |
# session["current_user"] = user.id | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment