Module: Office365::REST::Token

Included in:
API
Defined in:
lib/office365/rest/token.rb

Instance Method Summary collapse

Instance Method Details

#authorize_urlObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/office365/rest/token.rb', line 6

def authorize_url
  base_uri = [LOGIN_HOST, "/#{tenant_id}/oauth2/v2.0/authorize"].join
  azure_params = {
    client_id: client_id,
    client_secret: client_secret,
    scope: Office365::SCOPE,
    response_type: "code",
    response_mode: "query",
    redirect_uri: redirect_uri,
    state: SecureRandom.hex
  }.ms_hash_to_query

  [base_uri, "?", azure_params].join
end

#refresh_token!Object



25
26
27
28
29
# File 'lib/office365/rest/token.rb', line 25

def refresh_token!
  Models::AccessToken.new(
    Request.new(nil, debug: debug).post(token_url, token_params)
  )
end

#token_urlObject



21
22
23
# File 'lib/office365/rest/token.rb', line 21

def token_url
  [LOGIN_HOST, "/#{tenant_id}/oauth2/v2.0/token"].join
end