Created
July 26, 2011 15:03
-
-
Save daz-codes/1106958 to your computer and use it in GitHub Desktop.
Ominauth Twitter Login
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
set :uid => "123" | |
set :token => "kljkl26adFGGHHklfha77676sdHHTYklfj" | |
use OmniAuth::Builder do | |
provider :twitter, 'XXX', 'XXXX' | |
end | |
helpers do | |
def admin? | |
session[ settings.uid ] == settings.token | |
end | |
end | |
get '/auth/:provider/callback' do | |
auth = request.env['omniauth.auth'] | |
session[:user] = auth['user_info'] | |
session[auth['uid']]= settings.token if auth['uid'] == settings.uid && auth['provider'] == "twitter" | |
redirect '/' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment