Sha256: eeceaf1f8ca28d7bd70cc5b1b5ee8a85ea8d65b37abfee39411008f445654ad6
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
require 'omniauth-oauth2' module OmniAuth module Strategies class Identitas < OmniAuth::Strategies::OAuth2 # change the class name and the :name option to match your application name option :name, :identitas option :client_options, { site: "https://api.identitas.com", authorize_url: "/oauth/authorize" } uid { raw_info["id"] } info do { email: raw_info["email"], first_name: raw_info["first_name"], last_name: raw_info["last_name"], name: [raw_info["first_name"], raw_info["last_name"]].join(" ") } end extra do hash = {} hash['raw_info'] = raw_info unless skip_info? hash['m'] = request.params["m"] hash['application_info'] = application_info hash end def raw_info @raw_info ||= access_token.get('/v1/me').parsed["info"] rescue ::Errno::ETIMEDOUT raise ::Timeout::Error end # # https://github.com/intridea/omniauth-oauth2/issues/81 def callback_url full_host + script_name + callback_path + check_if_mobile end def check_if_mobile "?" + {m: options.authorize_params[:m]}.to_query end def setup_phase options.authorize_params[:m] = request.params["m"] end def application_info @application_info ||= access_token.get('/v1/app/info').parsed end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omniauth-identitas-0.2.3 | lib/omniauth/strategies/identitas.rb |