omniauth-myvr 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 889faeaf23f2728743d4d4ac499d3939b500fc10
4
- data.tar.gz: 546ae0c48e9dac5c5aa002810e0341639f15af32
3
+ metadata.gz: 001eab9387d340f299f09ca9734eec8b5998c27a
4
+ data.tar.gz: 672500a0dfc711015eb2f113be46c18a422c4cf7
5
5
  SHA512:
6
- metadata.gz: 4926110a493028e61b0e515257504decd8a20361b9e09d97ac1d433d308d4a343512db954139fa7be83997245024d024f10bd0c666783dc70a65861e201187d0
7
- data.tar.gz: 5b216a9731df026e9310726fe7d2995787651bf7befff3a0797b82e7c6272bf5543792f4dbaf7c6655871cc00b2cd26eb3fdfed1021d72080c39a6b735a97584
6
+ metadata.gz: 008f7c1a86476f4f9c1e113e200181ee4268d4d6515f14142511c4053b74180150acb029369be0c1c674346bb5e30f6a1b6cd97383f971a655b318083d3fa397
7
+ data.tar.gz: 220338e4c99582949d341023a60d30f7c5a669557afc69e7642c51e2ad6742be05081c0a3ea0b234e5a8f111b87841ef64212d2f9736fc7417ea3e014f8ae1ef
@@ -2,35 +2,36 @@ require 'multi_json'
2
2
  require 'jwt'
3
3
  require 'omniauth/strategies/oauth2'
4
4
  require 'uri'
5
+ require 'httplog'
5
6
 
6
7
  module OmniAuth
7
8
  module Strategies
8
9
  class Myvr < OmniAuth::Strategies::OAuth2
9
10
  BASE_SCOPE_URL = "http://local.api.myvr.com:8000/auth/"
10
- BASE_SCOPES = %w[profile email openid]
11
- DEFAULT_SCOPE = "email,profile"
11
+ BASE_SCOPES = %w[property_read]
12
+ DEFAULT_SCOPE = 'property_read'
12
13
 
13
14
  option :name, 'myvr'
14
- option :authorize_options, [
15
- :access_type,
16
- :hd,
17
- :login_hint,
18
- :prompt,
19
- :request_visible_actions,
20
- :scope,
21
- :state,
22
- :redirect_uri,
23
- :include_granted_scopes,
24
- :openid_realm
25
- ]
26
- option :authorized_client_ids, []
27
-
15
+ option :authorize_params, {grant_type: 'authorization_code'}
28
16
  option :client_options, {
29
17
  :site => 'http://local.myvr.com:8000/',
30
18
  :authorize_url => 'http://local.myvr.com:8000/connect/oauth/auth',
31
19
  :token_url => 'http://api.local.myvr.com:8000/oauth/token/'
32
20
  }
33
21
 
22
+ def request_phase
23
+ puts authorize_params
24
+ super
25
+ end
26
+
27
+ def authorize_params
28
+ super.tap do |params|
29
+ if request.params['scope']
30
+ params[:scope] = request.params['scope']
31
+ end
32
+ end
33
+ end
34
+
34
35
  # def authorize_params
35
36
  # super.tap do |params|
36
37
  # options[:authorize_options].each do |k|
@@ -99,26 +100,36 @@ module OmniAuth
99
100
  # @raw_image_info ||= access_token.get("https://www.googleapis.com/plus/v1/people/#{id}?fields=image").parsed
100
101
  # end
101
102
  #
102
- def custom_build_access_token
103
- verifier = request.params.fetch('code')
104
- # access_token =
105
- # if request.xhr? && request.params['code']
106
- # verifier = request.params['code']
107
- # client.auth_code.get_token(verifier, get_token_options('postmessage'), deep_symbolize(options.auth_token_params || {}))
108
- # elsif request.params['code'] && request.params['redirect_uri']
109
- # verifier = request.params['code']
110
- # redirect_uri = request.params['redirect_uri']
111
- # client.auth_code.get_token(verifier, get_token_options(redirect_uri), deep_symbolize(options.auth_token_params || {}))
112
- # elsif verify_token(request.params['access_token'])
113
- # ::OAuth2::AccessToken.from_hash(client, request.params.dup)
114
- # else
115
- # verifier = request.params["code"]
116
- client.auth_code.get_token(verifier)
117
- # end
118
- # verify_hd(access_token)
119
- # access_token
103
+ #
104
+ def build_access_token
105
+ token_params = {
106
+ :client_secret => client.secret,
107
+ :grant_type => 'authorization_code'
108
+ }
109
+ verifier = request.params['code']
110
+ client.auth_code.get_token(verifier, token_params)
120
111
  end
121
- alias_method :build_access_token, :custom_build_access_token
112
+
113
+ # def custom_build_access_token
114
+ # verifier = request.params.fetch('code')
115
+ # # access_token =
116
+ # # if request.xhr? && request.params['code']
117
+ # # verifier = request.params['code']
118
+ # # client.auth_code.get_token(verifier, get_token_options('postmessage'), deep_symbolize(options.auth_token_params || {}))
119
+ # # elsif request.params['code'] && request.params['redirect_uri']
120
+ # # verifier = request.params['code']
121
+ # # redirect_uri = request.params['redirect_uri']
122
+ # # client.auth_code.get_token(verifier, get_token_options(redirect_uri), deep_symbolize(options.auth_token_params || {}))
123
+ # # elsif verify_token(request.params['access_token'])
124
+ # # ::OAuth2::AccessToken.from_hash(client, request.params.dup)
125
+ # # else
126
+ # # verifier = request.params["code"]
127
+ # client.auth_code.get_token(verifier)
128
+ # # end
129
+ # # verify_hd(access_token)
130
+ # # access_token
131
+ # end
132
+ # alias_method :build_access_token, :custom_build_access_token
122
133
 
123
134
  private
124
135
 
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "omniauth-myvr"
6
- s.version = "0.0.15"
6
+ s.version = "0.0.16"
7
7
  s.authors = ["CJ Avilla"]
8
8
  s.email = ["cjavilla@gmail.com"]
9
9
  s.homepage = "https://github.com/w1zeman1p/omniauth-myvr"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-myvr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - CJ Avilla