Skip to content

Commit b60d1f8

Browse files
committedJul 11, 2024
#117 show token
1 parent 2f25c50 commit b60d1f8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎lib/glogin/auth.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,12 @@ def user(code)
6767
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
6868
req = Net::HTTP::Get.new(uri.request_uri)
6969
req['Accept-Header'] = 'application/json'
70-
req['Authorization'] = "token #{access_token(code)}"
70+
token = access_token(code)
71+
req['Authorization'] = "token #{token}"
7172
res = http.request(req)
72-
raise "Error (#{res.code}): #{res.body}" unless res.code == '200'
73+
unless res.code == '200'
74+
raise "Error (#{res.code}) with token #{token[0..6]}#{'*' * (token.length - 6)}: #{res.body}"
75+
end
7376
JSON.parse(res.body)
7477
end
7578

0 commit comments

Comments
 (0)