Skip to main content

autodesk-authentication - Autodesk Authentication SDK for Python

A Python SDK providing a Fluent API for the Autodesk Authentication APIs, generated from the official OpenAPI specifications using Microsoft Kiota.

Installation

pip install adsk-platform-authentication

Quick Start

from autodesk_authentication import AuthenticationClient

# Initialize the Authentication client
auth_client = AuthenticationClient()

2-Legged Token (Client Credentials)

import os
from autodesk_authentication import AuthenticationClient

client_id = os.environ["APS_CLIENT_ID"]
client_secret = os.environ["APS_CLIENT_SECRET"]

auth_client = AuthenticationClient()

token = await auth_client.helper.get_two_legged_token(
    client_id,
    client_secret,
    scopes=["data:read", "data:write", "account:read"],
)

print(f"Access Token: {token.access_token}")
print(f"Expires At: {token.expires_at}")

Auto-Refreshing Token

from autodesk_authentication import AuthenticationClient, InMemoryTokenStore

auth_client = AuthenticationClient()
token_store = InMemoryTokenStore()

get_token = auth_client.helper.create_two_legged_auto_refresh_token(
    client_id,
    client_secret,
    scopes=["data:read", "data:write"],
    token_store=token_store,
)

# This callable auto-refreshes when the token is about to expire
access_token = await get_token()

Using Scope Enum

from autodesk_authentication import AuthenticationClient, AuthenticationScope

auth_client = AuthenticationClient()

token = await auth_client.helper.get_two_legged_token(
    client_id,
    client_secret,
    scopes=[AuthenticationScope.DATA_READ, AuthenticationScope.ACCOUNT_READ],
)

3-Legged Authentication (Authorization Code)

from autodesk_authentication import AuthenticationClient, AuthenticationClientHelper, AuthenticationScope

# Step 1: Generate the login URL
login_url = AuthenticationClientHelper.create_authentication_url(
    client_id=client_id,
    redirect_uri="http://localhost:3000/callback",
    scope=[AuthenticationScope.DATA_READ, AuthenticationScope.VIEWABLES_READ],
)
print(f"Open this URL in a browser: {login_url}")

# Step 2: Extract the code from the callback URL
code = AuthenticationClientHelper.extract_code_from_url(callback_url)

3-Legged with PKCE

from autodesk_authentication import AuthenticationClientHelper, AuthenticationScope

# Generate PKCE challenge
code_verifier, code_challenge = AuthenticationClientHelper.create_pkce_code_challenge()

# Build the PKCE login URL
login_url = AuthenticationClientHelper.create_pkce_authentication_url(
    client_id=client_id,
    redirect_uri="http://localhost:3000/callback",
    scope=[AuthenticationScope.DATA_READ],
    code_challenge=code_challenge,
)

Refresh a 3-Legged Token

auth_client = AuthenticationClient()

refreshed = await auth_client.helper.refresh_three_legged_token(
    client_id=client_id,
    client_secret=client_secret,
    refresh_token="REFRESH_TOKEN_FROM_PREVIOUS_AUTH",
)
print(f"New access token: {refreshed.access_token}")

Get User Info

auth_client = AuthenticationClient()

user_info = await auth_client.helper.get_user_info(three_legged_token="YOUR_3L_TOKEN")
print(f"Name: {user_info.name}, Email: {user_info.email}")

Using the .api Property

The full generated API surface is accessible via auth_client.api:

# Direct API call (equivalent to what .helper methods do internally)
from autodesk_authentication.generated_code.authentication.v2.token.token_post_request_body import (
    TokenPostRequestBody,
)
from autodesk_authentication.generated_code.models.granttype import Granttype

body = TokenPostRequestBody()
body.grant_type = Granttype.Client_credentials
body.scope = "data:read"

result = await auth_client.api.authentication.v2.token.post(
    body,
    request_configuration=lambda r: r.headers.add("Authorization", auth_string),
)

Custom HTTP Client

You can provide your own httpx.AsyncClient instance:

import httpx

http_client = httpx.AsyncClient(timeout=60.0)
auth_client = AuthenticationClient(http_client=http_client)

Error Handling

from kiota_abstractions.api_error import APIError

try:
    token = await auth_client.helper.get_two_legged_token(client_id, client_secret, scopes)
except APIError as e:
    print(f"Request failed: {e.message}")
    print(f"Status code: {e.response_status_code}")

Requirements

  • Python 3.10 or later
  • Valid Autodesk Platform Services (APS) application credentials

Dependencies

  • microsoft-kiota-abstractions
  • microsoft-kiota-http
  • microsoft-kiota-serialization-json
  • microsoft-kiota-serialization-text
  • microsoft-kiota-serialization-form
  • microsoft-kiota-serialization-multipart
  • httpx

Documentation

License

This project is licensed under the MIT License.

Metadata

Release files for adsk-platform-authentication 0.2.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adsk-platform-authentication 0.2.10
File Size Uploaded Provenance
adsk_platform_authentication-0.2.10.tar.gz 19.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for adsk-platform-authentication 0.2.10
File Interpreter ABI Platform
adsk_platform_authentication-0.2.10-py3-none-any.whl Python 3 none any Details

Total release size: 61.2 kB

Release files / adsk_platform_authentication-0.2.10.tar.gz

Download URL adsk_platform_authentication-0.2.10.tar.gz
Size 19.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e8831255e7ac01332c9998687b75ed0be18ef2f384b3d83dee527817ef9c0fda
BLAKE2b-256 checksum
How to use checksums
0caafc4c0791f08a95781231ad6ef6f01e66e530f1bcb169ccf56056a1b5b5c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 23, 2026.

Transparency log

Release files / adsk_platform_authentication-0.2.10-py3-none-any.whl

Download URL adsk_platform_authentication-0.2.10-py3-none-any.whl
Size 42.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f56b481072d98ddd430a18337f9d30c4c18137b7b8856c581fc00f196bd46e5
BLAKE2b-256 checksum
How to use checksums
7ed50a70621b4d48277694691c14a8d81ea7c0c9a14242f3c6c40cd79324b438
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 23, 2026.

Transparency log

Security for adsk-platform-authentication 0.2.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for adsk_platform_authentication-0.2.10.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.10 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page