Class: HubSpotSDK::Resources::Auth::OAuth

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ OAuth

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

Parameters:



89
90
91
# File 'lib/hubspot_sdk/resources/auth/oauth.rb', line 89

def initialize(client:)
  @client = client
end

Instance Method Details

#create_token(client_id: nil, client_secret: nil, code: nil, code_verifier: nil, grant_type: nil, redirect_uri: nil, refresh_token: nil, scope: nil, request_options: {}) ⇒ StringIO

Authenticates a client and returns access and refresh tokens.

Parameters:

Returns:

  • (StringIO)

See Also:



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/hubspot_sdk/resources/auth/oauth.rb', line 24

def create_token(params = {})
  parsed, options = HubSpotSDK::Auth::OAuthCreateTokenParams.dump_request(params)
  @client.request(
    method: :post,
    path: "oauth/2026-03/token",
    headers: {"content-type" => "application/x-www-form-urlencoded", "accept" => "*/*"},
    body: parsed,
    model: StringIO,
    options: options
  )
end

#introspect_token(token: nil, client_id: nil, client_secret: nil, token_type_hint: nil, request_options: {}) ⇒ HubSpotSDK::Models::Auth::PublicAccessTokenInfoResponse, HubSpotSDK::Models::Auth::PublicRefreshTokenInfoResponse

Returns validity and metadata for access and refresh tokens.

Parameters:

  • token (String)
  • client_id (String)
  • client_secret (String)
  • token_type_hint (String)
  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/hubspot_sdk/resources/auth/oauth.rb', line 49

def introspect_token(params = {})
  parsed, options = HubSpotSDK::Auth::OAuthIntrospectTokenParams.dump_request(params)
  @client.request(
    method: :post,
    path: "oauth/2026-03/token/introspect",
    headers: {"content-type" => "application/x-www-form-urlencoded"},
    body: parsed,
    model: HubSpotSDK::Auth::TokenInfoResponseBaseIf,
    options: options
  )
end

#revoke_token(token: nil, client_id: nil, client_secret: nil, token_type_hint: nil, request_options: {}) ⇒ StringIO

Deletes/Revokes provided Refresh Token

Parameters:

  • token (String)
  • client_id (String)
  • client_secret (String)
  • token_type_hint (String)
  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/hubspot_sdk/resources/auth/oauth.rb', line 74

def revoke_token(params = {})
  parsed, options = HubSpotSDK::Auth::OAuthRevokeTokenParams.dump_request(params)
  @client.request(
    method: :post,
    path: "oauth/2026-03/token/revoke",
    headers: {"content-type" => "application/x-www-form-urlencoded", "accept" => "*/*"},
    body: parsed,
    model: StringIO,
    options: options
  )
end