Class: OSA::MSAuthClient
Instance Method Summary
collapse
Methods inherited from HttpClient
#delete, #get, #patch, #post
Constructor Details
Returns a new instance of MSAuthClient.
8
9
10
11
12
13
|
# File 'lib/osa/clients/ms_auth_client.rb', line 8
def initialize
connection = Faraday.new(
url: 'https://login.microsoft.com'
)
super connection
end
|
Instance Method Details
#code_token(code) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/osa/clients/ms_auth_client.rb', line 15
def code_token(code)
body = {
client_id: CLIENT_ID,
scope: SCOPE,
redirect_uri: REDIRECT_URL,
grant_type: :authorization_code,
code: code
}
post('/consumers/oauth2/v2.0/token', body, {})
end
|
#refresh_token(refresh_token) ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/osa/clients/ms_auth_client.rb', line 26
def refresh_token(refresh_token)
body = {
client_id: CLIENT_ID,
scope: SCOPE,
refresh_token: refresh_token,
grant_type: :refresh_token
}
post('/consumers/oauth2/v2.0/token', body)
end
|