class Stytch::M2M
def token(client_id:, client_secret:, scopes: nil)
The type of the returned access token. Today, this value will always be equal to "bearer"
token_type::
The type of this field is +Integer+.
For example, the value 3600 denotes that the access token will expire in one hour from the time the response was generated.
The lifetime in seconds of the access token.
expires_in::
The type of this field is +String+.
The access token granted to the client. Access tokens are JWTs signed with the project's JWKs.
access_token::
An object with the following fields:
== Returns:
The type of this field is nilable list of +String+.
An array scopes requested. If omitted, all scopes assigned to the client will be returned.
scopes::
The type of this field is +String+.
The secret of the client.
client_secret::
The type of this field is +String+.
The ID of the client.
client_id::
== Parameters:
M2M Access tokens contain a standard set of claims as well as any custom claims generated from templates.
Access tokens are JWTs signed with the project's JWKs, and are valid for one hour after issuance.
+token+ retrieves an access token for the given M2M Client.
MANUAL(M2M::token)(SERVICE_METHOD)
def token(client_id:, client_secret:, scopes: nil) request = { grant_type: 'client_credentials', client_id: client_id, client_secret: client_secret } request[:scope] = scopes.join(' ') unless scopes.nil? JSON.parse(post_request("/v1/public/#{@project_id}/oauth2/token", request), { symbolize_names: true }) end