Sha256: 9d55f83e99b2dbdf7e68c177ccd038dd7525cf30d23dde3bd8966360d32b8adf
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
require 'omniauth/oauth' require 'multi_json' module OmniAuth module Strategies # # Authenticate to Miso via OAuth and retrieve basic # user information. # # Usage: # # use OmniAuth::Strategies::Miso, 'consumerkey', 'consumersecret' # class Miso < OmniAuth::Strategies::OAuth def initialize(app, consumer_key=nil, consumer_secret=nil, options={}, &block) client_options = { :site => 'https://gomiso.com', } super(app, :miso, consumer_key, consumer_secret, client_options, options, &block) end def auth_hash OmniAuth::Utils.deep_merge(super, { 'uid' => user_hash['id'], 'user_info' => user_info, 'extra' => { 'user_hash' => user_hash, }, } ) end def user_info { 'nickname' => user_hash['username'], 'name' => user_hash['full_name'], 'image' => user_hash['profile_image_url'], 'description' => user_hash['tagline'], } end def user_hash @user_hash ||= MultiJson.decode(@access_token.get('/api/oauth/v1/users/show.json').body)['user'] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
oa-oauth-0.3.2 | lib/omniauth/strategies/oauth/miso.rb |
oa-oauth-0.3.0 | lib/omniauth/strategies/oauth/miso.rb |
oa-oauth-0.3.0.rc3 | lib/omniauth/strategies/oauth/miso.rb |