Checking Tool Authorization Status
Before executing that require authorization, you can check their authorization status to understand what permissions are needed and whether they’re currently available for a .
This is useful for:
- Displaying authorization requirements in your UI
- Pre-checking availability before execution
- Understanding which need approval
- Debugging authorization issues
Initialize the client
Import the in a Python/Javascript script.
Python
Python
from arcadepy import Arcade
client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variableCheck authorization status for all tools
You can get a list of all available and check their authorization status for a specific :
Python
Python
USER_ID = "{arcade_user_id}"
# Get all tools for the user
tools = client.tools.list(user_id=USER_ID)
for tool in tools:
print(f"Tool: {tool.name}")
if tool.requirements:
# Check if all requirements are met
print(f"Requirements met: {tool.requirements.met}")
# Check authorization status
if tool.requirements.authorization:
print(f"Authorization status: {tool.requirements.authorization.status}")
print(f"Token status: {tool.requirements.authorization.token_status}")
# Check secret requirements
if tool.requirements.secrets:
for secret in tool.requirements.secrets:
print(f"Secret '{secret.key}' met: {secret.met}")
if not secret.met and secret.status_reason:
print(f"Reason: {secret.status_reason}")
print("---")If a username is not provided, the Token Status will be excluded and only the requirements for the provider will be shown.
Check authorization status for a specific tool
You can also check the authorization status for a specific by name:
Python
Python
USER_ID = "{arcade_user_id}"
TOOL_NAME = "Gmail.ListEmails"
# Get specific tool details
tool = client.tools.get(tool_name=TOOL_NAME, user_id=USER_ID)
print(f"Tool: {tool.name}")
print(f"Description: {tool.description}")
if tool.requirements:
print(f"All requirements met: {tool.requirements.met}")
if tool.requirements.authorization:
auth = tool.requirements.authorization
print(f"Authorization required: {auth.provider_type}")
print(f"Authorization status: {auth.status}")
print(f"Token status: {auth.token_status}")
if auth.status_reason:
print(f"Status reason: {auth.status_reason}")
if tool.requirements.secrets:
print("Secret requirements:")
for secret in tool.requirements.secrets:
status = "✓" if secret.met else "✗"
print(f" {status} {secret.key}")Understanding the status values
Authorization Status
active: If the provider is configured and enabledinactive: Authorization is not found or is disabled
Token Status
not_started: Authorization process hasn’t begunpending: Authorization is in progress ( needs to approve)completed: Authorization is complete and tokens are availablefailed: Authorization process failed
Requirements Met
true: All requirements for the are satisfiedfalse: Some requirements are missing (authorization, secrets, etc.)
Secret Met
true: The secret exists for thefalse: The secret does not exist for the
Last updated on