Class: VitableConnect::Resources::Auth

Inherits:
Object
  • Object
show all
Defined in:
lib/vitable_connect/resources/auth.rb

Overview

Issue short-lived access tokens for scoped API access

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Auth

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Auth.

Parameters:



36
37
38
# File 'lib/vitable_connect/resources/auth.rb', line 36

def initialize(client:)
  @client = client
end

Instance Method Details

#issue_access_token(grant_type:, bound_entity: nil, request_options: {}) ⇒ VitableConnect::Models::AuthIssueAccessTokenResponse

Issues a short-lived access token from the authenticated API key. Access tokens can optionally be bound to a specific employer or employee for scoped access. Tokens expire after 15 minutes.

Parameters:

Returns:

See Also:



22
23
24
25
26
27
28
29
30
31
# File 'lib/vitable_connect/resources/auth.rb', line 22

def issue_access_token(params)
  parsed, options = VitableConnect::AuthIssueAccessTokenParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/auth/access-tokens",
    body: parsed,
    model: VitableConnect::Models::AuthIssueAccessTokenResponse,
    options: options
  )
end