Sha256: 3f99de334e89d7b7081f16dde036f3efedc0932c2cdd9531f8e8101b98b99faa
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
module UsosAuthLib class UsosController < ActionController::Base def authorize_user authorization_url = usos_authorizer.authorize(session, request) redirect_to authorization_url, allow_other_host: true end def callback verifier = params[:oauth_verifier] access_token = usos_authorizer.access_token(session, verifier, nil, nil) response = access_token.get('/services/users/user?fields=id|first_name|last_name|email|photo_urls') parsed_response = JSON.parse(response.body) puts parsed_response redirect_path = UsosAuthLib.configuration.redirect_path url = url_for(redirect_path) url << "?id=#{parsed_response['id']}&email=#{parsed_response['email']}" url << "&first_name=#{parsed_response['first_name']}&last_name=#{parsed_response['last_name']}" url << "&photo_url=#{parsed_response['photo_urls']['50x50']}" url << "&token=#{access_token.token}&secret=#{access_token.secret}" redirect_to url, allow_other_host: true end private def usos_authorizer UsosAuthLib::UsosAuthorizer.new end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
usos_auth_lib-0.1.0 | app/controllers/usos_auth_lib/usos_controller.rb |