Method: Auth0::Api::AuthenticationEndpoints#api_token
- Defined in:
- lib/auth0/api/authentication_endpoints.rb
#api_token(client_id: @client_id, client_secret: @client_secret, organization: @organization, audience: nil) ⇒ json
Request an API access token using a Client Credentials grant
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/auth0/api/authentication_endpoints.rb', line 25 def api_token( client_id: @client_id, client_secret: @client_secret, organization: @organization, audience: nil ) request_params = { grant_type: 'client_credentials', client_id: client_id, audience: audience, organization: organization } populate_client_assertion_or_secret(request_params, client_id: client_id, client_secret: client_secret) response = request_with_retry(:post, '/oauth/token', request_params) ::Auth0::ApiToken.new(response['access_token'], response['scope'], response['expires_in']) end |