Class: WhopSDK::Resources::AccessTokens

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

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:



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

def initialize(client:)
  @client = client
end

Instance Method Details

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

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

Create a short-lived access token to authenticate API requests on behalf of a Company or User. This token should be used with Whop’s web and mobile embedded components. You must provide either a company_id or a user_id argument, but not both.

Parameters:

  • company_id (String)

    The ID of the Company to generate the token for. The API key must have permissio

  • user_id (String)

    The ID of the User to generate the token for. The API key must have permission t

  • expires_at (Time, nil)

    The expiration timestamp for the access token. If not provided, a default expira

  • scoped_actions (Array<String>, nil)

    Array of desired scoped actions for the access token. If sent as an empty array

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

Returns:

See Also:



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

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