Sha256: 283772e16bf99775b8aa1c1f2411ec685f322bb695685f270ff933285f038279
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
require 'omniauth-oauth2' module OmniAuth module Strategies class Accounts9 < OmniAuth::Strategies::OAuth2 option :name, 'accounts9' option :client_options, {:authorize_url => '/api/authorize', :token_url => '/api/access_token', :site => 'https://accounts.net9.org'} option :token_params, { :parse => :json } def request_phase super end def authorize_params super.tap do |params| %w[scope client_options].each do |v| if request.params[v] params[v.to_sym] = request.params[v] end end end end uid { raw_info['uid'].to_s } info do { :email => raw_info['email'], :nickname => raw_info['name'], :last_name => raw_info['surname'], :first_name => raw_info['givenname'], :name => raw_info['fullname'], :location => raw_info['address'], :description => raw_info['bio'], :urls => { 'Website' => raw_info['website'], } } end extra do { :raw_info => raw_info } end def raw_info access_token.options[:mode] = :query access_token.options[:param_name] = 'access_token' @raw_info ||= access_token.get('https://accounts.net9.org/api/userinfo').parsed['user'] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omniauth-accounts9-1.0.1 | lib/omniauth/strategies/accounts9.rb |