Sha256: 81196ef795cba2c2f8c037966870c90989bd7871331ca75535516cb0bae7b89e
Contents?: true
Size: 959 Bytes
Versions: 1
Compression:
Stored size: 959 Bytes
Contents
# frozen_string_literal: true require "omniauth-oauth" require "json" module OmniAuth module Strategies class Pbs < OmniAuth::Strategies::OAuth option :name, "pbs" option :callback_url, "/oauth/callback" option :client_options, { site: "https://usosapps.pbs.edu.pl", request_token_url: "/services/oauth/request_token?scopes=email", authorize_url: "https://usosapps.pbs.edu.pl/services/oauth/authorize", access_token_url: "/services/oauth/access_token" } uid { raw_info["id"] } info do { email: raw_info["email"], first_name: raw_info["first_name"], last_name: raw_info["last_name"] } end extra do skip_info? ? {} : { raw_info: raw_info } end def raw_info @raw_info ||= JSON.parse(access_token.get("/services/users/user?fields=id|first_name|last_name|email").body) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omniauth-usos-0.1.0 | lib/omniauth/strategies/pbs.rb |