Module: Idoklad::Auth

Defined in:
lib/idoklad/auth.rb

Constant Summary collapse

AUTHORIZE_URL =
'/identity/server/connect/authorize'
TOKEN_URL =
'/identity/server/connect/token'
SCOPE =
'idoklad_api'

Class Method Summary collapse

Class Method Details

.get_tokenObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/idoklad/auth.rb', line 9

def self.get_token
  client = OAuth2::Client.new(
    Idoklad.configuration.client_id,
    Idoklad.configuration.client_secret,
    :authorize_url => AUTHORIZE_URL,
    :token_url => TOKEN_URL,
    :site => Idoklad::API_URL
  )

  token = client.client_credentials.get_token(:scope => SCOPE)
  token.token
end