Class: WhopSDK::Resources::AccessTokens

Inherits:
Object
  • Object
show all
Defined in:
lib/whop_sdk/resources/access_tokens.rb

Overview

Access tokens

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ AccessTokens

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 AccessTokens.

Parameters:



44
45
46
# File 'lib/whop_sdk/resources/access_tokens.rb', line 44

def initialize(client:)
  @client = client
end

Instance Method Details

#create(company_id: nil, expires_at: nil, scoped_actions: nil, user_id: nil, request_options: {}) ⇒ WhopSDK::Models::AccessTokenCreateResponse

Some parameter documentations has been truncated, see Models::AccessTokenCreateParams for more details.

Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop’s web and mobile embedded components.

Parameters:

  • company_id (String, nil)

    The unique identifier of the company to generate the token for, starting with ‘b

  • expires_at (Time, nil)

    The expiration timestamp for the access token. Defaults to 1 hour from now, with

  • scoped_actions (Array<String>, nil)

    An array of permission scopes to grant to the access token. If empty or omitted,

  • user_id (String, nil)

    The unique identifier of the user to generate the token for, starting with ‘user

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
# File 'lib/whop_sdk/resources/access_tokens.rb', line 30

def create(params = {})
  parsed, options = WhopSDK::AccessTokenCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "access_tokens",
    body: parsed,
    model: WhopSDK::Models::AccessTokenCreateResponse,
    options: options
  )
end