Skip to content

Latest commit

 

History

History
99 lines (63 loc) · 7.04 KB

File metadata and controls

99 lines (63 loc) · 7.04 KB

Tools

Overview

Available Operations

get_action_pack_auth_status

Reports whether the calling user is already authenticated against the third-party tool backing the specified action pack. Intended for headless / server-driven clients that render an "Authorize" prompt when the user has not yet consented to the tool.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    res = glean.tools.get_action_pack_auth_status(action_pack_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
action_pack_id str ✔️ ID of the action pack to query or authorize.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ActionPackAuthStatusResponse

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

authorize_action_pack

Starts the third-party OAuth flow for the specified action pack and returns the redirect URL that the client should navigate the end user to. After the OAuth callback completes, the user's browser is redirected back to returnUrl with a status query parameter (?glean_action_auth=success|error&actionPackId=...).

returnUrl must match the tenant's configured return URL allowlist; otherwise the request is rejected with 400.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    res = glean.tools.authorize_action_pack(action_pack_id="<id>", return_url="https://merry-allocation.org/")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
action_pack_id str ✔️ ID of the action pack to query or authorize.
return_url str ✔️ URL on the customer's domain to redirect the end user's browser back to after the third-party OAuth
callback completes. Must be present in the tenant's return URL allowlist.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.AuthorizeActionPackResponse

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*