# This file was auto-generated by Fern from our API Definition.
import typing
from json.decoder import JSONDecodeError
from ..core.api_error import ApiError
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.http_response import AsyncHttpResponse, HttpResponse
from ..core.jsonable_encoder import encode_path_param
from ..core.pagination import AsyncPager, SyncPager
from ..core.parse_error import ParsingError
from ..core.pydantic_utilities import parse_obj_as
from ..core.request_options import RequestOptions
from ..core.serialization import convert_and_respect_annotation_metadata
from ..errors.bad_request_error import BadRequestError
from ..errors.conflict_error import ConflictError
from ..errors.forbidden_error import ForbiddenError
from ..errors.internal_server_error import InternalServerError
from ..errors.not_found_error import NotFoundError
from ..errors.too_many_requests_error import TooManyRequestsError
from ..errors.unauthorized_error import UnauthorizedError
from ..types.client import Client
from ..types.client_addons import ClientAddons
from ..types.client_app_type_enum import ClientAppTypeEnum
from ..types.client_async_approval_notifications_channels_api_patch_configuration import (
ClientAsyncApprovalNotificationsChannelsApiPatchConfiguration,
)
from ..types.client_async_approval_notifications_channels_api_post_configuration import (
ClientAsyncApprovalNotificationsChannelsApiPostConfiguration,
)
from ..types.client_authentication_method import ClientAuthenticationMethod
from ..types.client_compliance_level_enum import ClientComplianceLevelEnum
from ..types.client_create_authentication_method import ClientCreateAuthenticationMethod
from ..types.client_default_organization import ClientDefaultOrganization
from ..types.client_encryption_key import ClientEncryptionKey
from ..types.client_jwt_configuration import ClientJwtConfiguration
from ..types.client_metadata import ClientMetadata
from ..types.client_mobile import ClientMobile
from ..types.client_my_organization_patch_configuration import ClientMyOrganizationPatchConfiguration
from ..types.client_my_organization_post_configuration import ClientMyOrganizationPostConfiguration
from ..types.client_oidc_backchannel_logout_settings import ClientOidcBackchannelLogoutSettings
from ..types.client_organization_discovery_enum import ClientOrganizationDiscoveryEnum
from ..types.client_organization_require_behavior_enum import ClientOrganizationRequireBehaviorEnum
from ..types.client_organization_require_behavior_patch_enum import ClientOrganizationRequireBehaviorPatchEnum
from ..types.client_organization_usage_enum import ClientOrganizationUsageEnum
from ..types.client_organization_usage_patch_enum import ClientOrganizationUsagePatchEnum
from ..types.client_redirection_policy_enum import ClientRedirectionPolicyEnum
from ..types.client_refresh_token_configuration import ClientRefreshTokenConfiguration
from ..types.client_session_transfer_configuration import ClientSessionTransferConfiguration
from ..types.client_signed_request_object_with_credential_id import ClientSignedRequestObjectWithCredentialId
from ..types.client_signed_request_object_with_public_key import ClientSignedRequestObjectWithPublicKey
from ..types.client_third_party_security_mode_enum import ClientThirdPartySecurityModeEnum
from ..types.client_token_endpoint_auth_method_enum import ClientTokenEndpointAuthMethodEnum
from ..types.client_token_endpoint_auth_method_or_null_enum import ClientTokenEndpointAuthMethodOrNullEnum
from ..types.client_token_exchange_configuration import ClientTokenExchangeConfiguration
from ..types.client_token_exchange_configuration_or_null import ClientTokenExchangeConfigurationOrNull
from ..types.client_token_vault_privileged_access_with_credential_id import (
ClientTokenVaultPrivilegedAccessWithCredentialId,
)
from ..types.client_token_vault_privileged_access_with_public_key import ClientTokenVaultPrivilegedAccessWithPublicKey
from ..types.create_client_response_content import CreateClientResponseContent
from ..types.create_identity_assertion_authorization_grant import CreateIdentityAssertionAuthorizationGrant
from ..types.create_token_quota import CreateTokenQuota
from ..types.express_configuration import ExpressConfiguration
from ..types.express_configuration_or_null import ExpressConfigurationOrNull
from ..types.fed_cm_login import FedCmLogin
from ..types.fed_cm_login_patch import FedCmLoginPatch
from ..types.get_client_response_content import GetClientResponseContent
from ..types.list_clients_offset_paginated_response_content import ListClientsOffsetPaginatedResponseContent
from ..types.native_social_login import NativeSocialLogin
from ..types.native_social_login_patch import NativeSocialLoginPatch
from ..types.preview_cimd_metadata_response_content import PreviewCimdMetadataResponseContent
from ..types.register_cimd_client_response_content import RegisterCimdClientResponseContent
from ..types.rotate_client_secret_response_content import RotateClientSecretResponseContent
from ..types.update_client_response_content import UpdateClientResponseContent
from ..types.update_identity_assertion_authorization_grant import UpdateIdentityAssertionAuthorizationGrant
from ..types.update_token_quota import UpdateTokenQuota
from pydantic import ValidationError
# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)
class RawClientsClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper
def list(
self,
*,
fields: typing.Optional[str] = None,
include_fields: typing.Optional[bool] = None,
page: typing.Optional[int] = 0,
per_page: typing.Optional[int] = 50,
include_totals: typing.Optional[bool] = True,
is_global: typing.Optional[bool] = None,
is_first_party: typing.Optional[bool] = None,
app_type: typing.Optional[str] = None,
external_client_id: typing.Optional[str] = None,
q: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> SyncPager[Client, ListClientsOffsetPaginatedResponseContent]:
"""
Retrieve clients (applications and SSO integrations) matching provided filters. A list of fields to include or exclude may also be specified.
For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on).
- The following can be retrieved with any scope:
`client_id`, `app_type`, `name`, and `description`.
- The following properties can only be retrieved with the `read:clients` or
`read:client_keys` scope:
`callbacks`, `oidc_logout`, `allowed_origins`,
`web_origins`, `tenant`, `global`, `config_route`,
`callback_url_template`, `jwt_configuration`,
`jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`,
`jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`,
`logo_uri`, `allowed_clients`, `owners`, `custom_login_page`,
`custom_login_page_off`, `sso`, `addons`, `form_template`,
`custom_login_page_codeview`, `resource_servers`, `client_metadata`,
`mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`,
`token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`,
`is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`,
`refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`,
`refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`,
`organization_require_behavior`.
- The following properties can only be retrieved with the
`read:client_keys` or `read:client_credentials` scope:
`encryption_key`, `encryption_key.pub`, `encryption_key.cert`,
`client_secret`, `client_authentication_methods` and `signing_key`.
Parameters
----------
fields : typing.Optional[str]
Comma-separated list of fields to include or exclude (based on value provided for include_fields) in the result. Leave empty to retrieve all fields.
include_fields : typing.Optional[bool]
Whether specified fields are to be included (true) or excluded (false).
page : typing.Optional[int]
Page index of the results to return. First page is 0.
per_page : typing.Optional[int]
Number of results per page. Default value is 50, maximum value is 100
include_totals : typing.Optional[bool]
Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).
is_global : typing.Optional[bool]
Optional filter on the global client parameter.
is_first_party : typing.Optional[bool]
Optional filter on whether or not a client is a first-party client.
app_type : typing.Optional[str]
Optional filter by a comma-separated list of application types.
external_client_id : typing.Optional[str]
Optional filter by the Client ID Metadata Document URI for CIMD-registered clients.
q : typing.Optional[str]
Advanced Query in Lucene syntax.
Permitted Queries:
true to disable Single Sign On, false otherwise (default: false)
custom_login_page_on : typing.Optional[bool]
true if the custom login page is to be used, false otherwise. Defaults to true
custom_login_page : typing.Optional[str]
The content (HTML, CSS, JS) of the custom login page.
custom_login_page_preview : typing.Optional[str]
The content (HTML, CSS, JS) of the custom login page. (Used on Previews)
form_template : typing.Optional[str]
HTML form template to be used for WS-Federation.
addons : typing.Optional[ClientAddons]
client_metadata : typing.Optional[ClientMetadata]
mobile : typing.Optional[ClientMobile]
initiate_login_uri : typing.Optional[str]
Initiate login uri, must be https
native_social_login : typing.Optional[NativeSocialLogin]
fedcm_login : typing.Optional[FedCmLogin]
refresh_token : typing.Optional[ClientRefreshTokenConfiguration]
default_organization : typing.Optional[ClientDefaultOrganization]
organization_usage : typing.Optional[ClientOrganizationUsageEnum]
organization_require_behavior : typing.Optional[ClientOrganizationRequireBehaviorEnum]
organization_discovery_methods : typing.Optional[typing.Sequence[ClientOrganizationDiscoveryEnum]]
Defines the available methods for organization discovery during the `pre_login_prompt`. Users can discover their organization either by `email`, `organization_name` or both.
client_authentication_methods : typing.Optional[ClientCreateAuthenticationMethod]
require_pushed_authorization_requests : typing.Optional[bool]
Makes the use of Pushed Authorization Requests mandatory for this client
require_proof_of_possession : typing.Optional[bool]
Makes the use of Proof-of-Possession mandatory for this client
signed_request_object : typing.Optional[ClientSignedRequestObjectWithPublicKey]
token_vault_privileged_access : typing.Optional[ClientTokenVaultPrivilegedAccessWithPublicKey]
compliance_level : typing.Optional[ClientComplianceLevelEnum]
skip_non_verifiable_callback_uri_confirmation_prompt : typing.Optional[bool]
Controls whether a confirmation prompt is shown during login flows when the redirect URI uses non-verifiable callback URIs (for example, a custom URI schema such as `myapp://`, or `localhost`).
If set to true, a confirmation prompt will not be shown. We recommend that this is set to false for improved protection from malicious apps.
See https://auth0.com/docs/secure/security-guidance/measures-against-app-impersonation for more information.
token_exchange : typing.Optional[ClientTokenExchangeConfiguration]
par_request_expiry : typing.Optional[int]
Specifies how long, in seconds, a Pushed Authorization Request URI remains valid
token_quota : typing.Optional[CreateTokenQuota]
resource_server_identifier : typing.Optional[str]
The identifier of the resource server that this client is linked to.
identity_assertion_authorization_grant : typing.Optional[CreateIdentityAssertionAuthorizationGrant]
third_party_security_mode : typing.Optional[ClientThirdPartySecurityModeEnum]
redirection_policy : typing.Optional[ClientRedirectionPolicyEnum]
express_configuration : typing.Optional[ExpressConfiguration]
my_organization_configuration : typing.Optional[ClientMyOrganizationPostConfiguration]
async_approval_notification_channels : typing.Optional[ClientAsyncApprovalNotificationsChannelsApiPostConfiguration]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
HttpResponse[CreateClientResponseContent]
Client successfully created.
"""
_response = self._client_wrapper.httpx_client.request(
"clients",
method="POST",
json={
"name": name,
"description": description,
"logo_uri": logo_uri,
"callbacks": callbacks,
"oidc_logout": convert_and_respect_annotation_metadata(
object_=oidc_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
),
"oidc_backchannel_logout": convert_and_respect_annotation_metadata(
object_=oidc_backchannel_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
),
"session_transfer": convert_and_respect_annotation_metadata(
object_=session_transfer,
annotation=typing.Optional[ClientSessionTransferConfiguration],
direction="write",
),
"allowed_origins": allowed_origins,
"web_origins": web_origins,
"client_aliases": client_aliases,
"allowed_clients": allowed_clients,
"allowed_logout_urls": allowed_logout_urls,
"grant_types": grant_types,
"token_endpoint_auth_method": token_endpoint_auth_method,
"is_token_endpoint_ip_header_trusted": is_token_endpoint_ip_header_trusted,
"app_type": app_type,
"is_first_party": is_first_party,
"oidc_conformant": oidc_conformant,
"jwt_configuration": convert_and_respect_annotation_metadata(
object_=jwt_configuration, annotation=ClientJwtConfiguration, direction="write"
),
"encryption_key": convert_and_respect_annotation_metadata(
object_=encryption_key, annotation=typing.Optional[ClientEncryptionKey], direction="write"
),
"sso": sso,
"cross_origin_authentication": cross_origin_authentication,
"cross_origin_loc": cross_origin_loc,
"sso_disabled": sso_disabled,
"custom_login_page_on": custom_login_page_on,
"custom_login_page": custom_login_page,
"custom_login_page_preview": custom_login_page_preview,
"form_template": form_template,
"addons": convert_and_respect_annotation_metadata(
object_=addons, annotation=ClientAddons, direction="write"
),
"client_metadata": client_metadata,
"mobile": convert_and_respect_annotation_metadata(
object_=mobile, annotation=ClientMobile, direction="write"
),
"initiate_login_uri": initiate_login_uri,
"native_social_login": convert_and_respect_annotation_metadata(
object_=native_social_login, annotation=NativeSocialLogin, direction="write"
),
"fedcm_login": convert_and_respect_annotation_metadata(
object_=fedcm_login, annotation=FedCmLogin, direction="write"
),
"refresh_token": convert_and_respect_annotation_metadata(
object_=refresh_token,
annotation=typing.Optional[ClientRefreshTokenConfiguration],
direction="write",
),
"default_organization": convert_and_respect_annotation_metadata(
object_=default_organization,
annotation=typing.Optional[ClientDefaultOrganization],
direction="write",
),
"organization_usage": organization_usage,
"organization_require_behavior": organization_require_behavior,
"organization_discovery_methods": organization_discovery_methods,
"client_authentication_methods": convert_and_respect_annotation_metadata(
object_=client_authentication_methods,
annotation=ClientCreateAuthenticationMethod,
direction="write",
),
"require_pushed_authorization_requests": require_pushed_authorization_requests,
"require_proof_of_possession": require_proof_of_possession,
"signed_request_object": convert_and_respect_annotation_metadata(
object_=signed_request_object, annotation=ClientSignedRequestObjectWithPublicKey, direction="write"
),
"token_vault_privileged_access": convert_and_respect_annotation_metadata(
object_=token_vault_privileged_access,
annotation=ClientTokenVaultPrivilegedAccessWithPublicKey,
direction="write",
),
"compliance_level": compliance_level,
"skip_non_verifiable_callback_uri_confirmation_prompt": skip_non_verifiable_callback_uri_confirmation_prompt,
"token_exchange": convert_and_respect_annotation_metadata(
object_=token_exchange, annotation=ClientTokenExchangeConfiguration, direction="write"
),
"par_request_expiry": par_request_expiry,
"token_quota": convert_and_respect_annotation_metadata(
object_=token_quota, annotation=CreateTokenQuota, direction="write"
),
"resource_server_identifier": resource_server_identifier,
"identity_assertion_authorization_grant": convert_and_respect_annotation_metadata(
object_=identity_assertion_authorization_grant,
annotation=CreateIdentityAssertionAuthorizationGrant,
direction="write",
),
"third_party_security_mode": third_party_security_mode,
"redirection_policy": redirection_policy,
"express_configuration": convert_and_respect_annotation_metadata(
object_=express_configuration, annotation=ExpressConfiguration, direction="write"
),
"my_organization_configuration": convert_and_respect_annotation_metadata(
object_=my_organization_configuration,
annotation=ClientMyOrganizationPostConfiguration,
direction="write",
),
"async_approval_notification_channels": async_approval_notification_channels,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
CreateClientResponseContent,
parse_obj_as(
type_=CreateClientResponseContent, # type: ignore
object_=_response.json(),
),
)
return HttpResponse(response=_response, data=_data)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 401:
raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 403:
raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 404:
raise NotFoundError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 409:
raise ConflictError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
def preview_cimd_metadata(
self, *, external_client_id: str, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[PreviewCimdMetadataResponseContent]:
"""
Fetches and validates a Client ID Metadata Document without creating a client.
Returns the raw metadata and how it would be mapped to Auth0 client fields.
This endpoint is useful for testing metadata URIs before creating CIMD clients.
Parameters
----------
external_client_id : str
URL to the Client ID Metadata Document
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
HttpResponse[PreviewCimdMetadataResponseContent]
Metadata successfully fetched and validated, or retrieval error returned with errors array.
"""
_response = self._client_wrapper.httpx_client.request(
"clients/cimd/preview",
method="POST",
json={
"external_client_id": external_client_id,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
PreviewCimdMetadataResponseContent,
parse_obj_as(
type_=PreviewCimdMetadataResponseContent, # type: ignore
object_=_response.json(),
),
)
return HttpResponse(response=_response, data=_data)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 401:
raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 403:
raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 500:
raise InternalServerError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
def register_cimd_client(
self, *, external_client_id: str, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[RegisterCimdClientResponseContent]:
"""
Idempotent registration for Client ID Metadata Document (CIMD) clients.
Uses external_client_id as the unique identifier for upsert operations.
**Create:** Returns 201 when a new client is created (requires `create:clients` scope).
**Update:** Returns 200 when an existing client is updated (requires `update:clients` scope).
This endpoint automatically:
- Fetches and validates the metadata document
- Maps CIMD fields to Auth0 client configuration
- Creates/rotates credentials from the JWKS
- Enforces CIMD security policies (HTTPS-only, no shared secrets)
Parameters
----------
external_client_id : str
URL to the Client ID Metadata Document. Acts as the unique identifier for upsert operations.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
HttpResponse[RegisterCimdClientResponseContent]
CIMD client successfully updated (idempotent).
"""
_response = self._client_wrapper.httpx_client.request(
"clients/cimd/register",
method="POST",
json={
"external_client_id": external_client_id,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
RegisterCimdClientResponseContent,
parse_obj_as(
type_=RegisterCimdClientResponseContent, # type: ignore
object_=_response.json(),
),
)
return HttpResponse(response=_response, data=_data)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 401:
raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 403:
raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 500:
raise InternalServerError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
def get(
self,
id: str,
*,
fields: typing.Optional[str] = None,
include_fields: typing.Optional[bool] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetClientResponseContent]:
"""
Retrieve client details by ID. Clients are SSO connections or Applications linked with your Auth0 tenant. A list of fields to include or exclude may also be specified.
For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on).
- The following properties can be retrieved with any of the scopes:
`client_id`, `app_type`, `name`, and `description`.
- The following properties can only be retrieved with the `read:clients` or
`read:client_keys` scopes:
`callbacks`, `oidc_logout`, `allowed_origins`,
`web_origins`, `tenant`, `global`, `config_route`,
`callback_url_template`, `jwt_configuration`,
`jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`,
`jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`,
`logo_uri`, `allowed_clients`, `owners`, `custom_login_page`,
`custom_login_page_off`, `sso`, `addons`, `form_template`,
`custom_login_page_codeview`, `resource_servers`, `client_metadata`,
`mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`,
`token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`,
`is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`,
`refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`,
`refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`,
`organization_require_behavior`.
- The following properties can only be retrieved with the `read:client_keys` or `read:client_credentials` scopes:
`encryption_key`, `encryption_key.pub`, `encryption_key.cert`,
`client_secret`, `client_authentication_methods` and `signing_key`.
Parameters
----------
id : str
ID of the client to retrieve.
fields : typing.Optional[str]
Comma-separated list of fields to include or exclude (based on value provided for include_fields) in the result. Leave empty to retrieve all fields.
include_fields : typing.Optional[bool]
Whether specified fields are to be included (true) or excluded (false).
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
HttpResponse[GetClientResponseContent]
Client successfully retrieved.
"""
_response = self._client_wrapper.httpx_client.request(
f"clients/{encode_path_param(id)}",
method="GET",
params={
"fields": fields,
"include_fields": include_fields,
},
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
GetClientResponseContent,
parse_obj_as(
type_=GetClientResponseContent, # type: ignore
object_=_response.json(),
),
)
return HttpResponse(response=_response, data=_data)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 401:
raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 403:
raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 404:
raise NotFoundError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
"""
Delete a client and related configuration (rules, connections, etc).
Parameters
----------
id : str
ID of the client to delete.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
HttpResponse[None]
"""
_response = self._client_wrapper.httpx_client.request(
f"clients/{encode_path_param(id)}",
method="DELETE",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return HttpResponse(response=_response, data=None)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 401:
raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 403:
raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
def update(
self,
id: str,
*,
name: typing.Optional[str] = OMIT,
description: typing.Optional[str] = OMIT,
client_secret: typing.Optional[str] = OMIT,
logo_uri: typing.Optional[str] = OMIT,
callbacks: typing.Optional[typing.Sequence[str]] = OMIT,
oidc_logout: typing.Optional[ClientOidcBackchannelLogoutSettings] = OMIT,
oidc_backchannel_logout: typing.Optional[ClientOidcBackchannelLogoutSettings] = OMIT,
session_transfer: typing.Optional[ClientSessionTransferConfiguration] = OMIT,
allowed_origins: typing.Optional[typing.Sequence[str]] = OMIT,
web_origins: typing.Optional[typing.Sequence[str]] = OMIT,
grant_types: typing.Optional[typing.Sequence[str]] = OMIT,
client_aliases: typing.Optional[typing.Sequence[str]] = OMIT,
allowed_clients: typing.Optional[typing.Sequence[str]] = OMIT,
allowed_logout_urls: typing.Optional[typing.Sequence[str]] = OMIT,
jwt_configuration: typing.Optional[ClientJwtConfiguration] = OMIT,
encryption_key: typing.Optional[ClientEncryptionKey] = OMIT,
sso: typing.Optional[bool] = OMIT,
cross_origin_authentication: typing.Optional[bool] = OMIT,
cross_origin_loc: typing.Optional[str] = OMIT,
sso_disabled: typing.Optional[bool] = OMIT,
custom_login_page_on: typing.Optional[bool] = OMIT,
token_endpoint_auth_method: typing.Optional[ClientTokenEndpointAuthMethodOrNullEnum] = OMIT,
is_token_endpoint_ip_header_trusted: typing.Optional[bool] = OMIT,
app_type: typing.Optional[ClientAppTypeEnum] = OMIT,
is_first_party: typing.Optional[bool] = OMIT,
oidc_conformant: typing.Optional[bool] = OMIT,
custom_login_page: typing.Optional[str] = OMIT,
custom_login_page_preview: typing.Optional[str] = OMIT,
token_quota: typing.Optional[UpdateTokenQuota] = OMIT,
identity_assertion_authorization_grant: typing.Optional[UpdateIdentityAssertionAuthorizationGrant] = OMIT,
form_template: typing.Optional[str] = OMIT,
addons: typing.Optional[ClientAddons] = OMIT,
client_metadata: typing.Optional[ClientMetadata] = OMIT,
mobile: typing.Optional[ClientMobile] = OMIT,
initiate_login_uri: typing.Optional[str] = OMIT,
native_social_login: typing.Optional[NativeSocialLoginPatch] = OMIT,
fedcm_login: typing.Optional[FedCmLoginPatch] = OMIT,
refresh_token: typing.Optional[ClientRefreshTokenConfiguration] = OMIT,
default_organization: typing.Optional[ClientDefaultOrganization] = OMIT,
organization_usage: typing.Optional[ClientOrganizationUsagePatchEnum] = OMIT,
organization_require_behavior: typing.Optional[ClientOrganizationRequireBehaviorPatchEnum] = OMIT,
organization_discovery_methods: typing.Optional[typing.Sequence[ClientOrganizationDiscoveryEnum]] = OMIT,
client_authentication_methods: typing.Optional[ClientAuthenticationMethod] = OMIT,
require_pushed_authorization_requests: typing.Optional[bool] = OMIT,
require_proof_of_possession: typing.Optional[bool] = OMIT,
signed_request_object: typing.Optional[ClientSignedRequestObjectWithCredentialId] = OMIT,
token_vault_privileged_access: typing.Optional[ClientTokenVaultPrivilegedAccessWithCredentialId] = OMIT,
compliance_level: typing.Optional[ClientComplianceLevelEnum] = OMIT,
skip_non_verifiable_callback_uri_confirmation_prompt: typing.Optional[bool] = OMIT,
token_exchange: typing.Optional[ClientTokenExchangeConfigurationOrNull] = OMIT,
par_request_expiry: typing.Optional[int] = OMIT,
express_configuration: typing.Optional[ExpressConfigurationOrNull] = OMIT,
my_organization_configuration: typing.Optional[ClientMyOrganizationPatchConfiguration] = OMIT,
async_approval_notification_channels: typing.Optional[
ClientAsyncApprovalNotificationsChannelsApiPatchConfiguration
] = OMIT,
third_party_security_mode: typing.Optional[ClientThirdPartySecurityModeEnum] = OMIT,
redirection_policy: typing.Optional[ClientRedirectionPolicyEnum] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[UpdateClientResponseContent]:
"""
Updates a client's settings. For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on).
Notes:
- The `client_secret` and `signing_key` attributes can only be updated with the `update:client_keys` scope.
- The `client_authentication_methods` and `token_endpoint_auth_method` properties are mutually exclusive. Use `client_authentication_methods` to configure the client with Private Key JWT authentication method. Otherwise, use `token_endpoint_auth_method` to configure the client with client secret (basic or post) or with no authentication method (none).
- When using `client_authentication_methods` to configure the client with Private Key JWT authentication method, only specify the credential IDs that were generated when creating the credentials on the client.
- To configure `client_authentication_methods`, the `update:client_credentials` scope is required.
- To configure `client_authentication_methods`, the property `jwt_configuration.alg` must be set to RS256.
- To change a client's `is_first_party` property to `false`, the `organization_usage` and `organization_require_behavior` properties must be unset.
Parameters
----------
id : str
ID of the client to update.
name : typing.Optional[str]
The name of the client. Must contain at least one character. Does not allow '<' or '>'.
description : typing.Optional[str]
Free text description of the purpose of the Client. (Max character length: 140)
client_secret : typing.Optional[str]
The secret used to sign tokens for the client
logo_uri : typing.Optional[str]
The URL of the client logo (recommended size: 150x150)
callbacks : typing.Optional[typing.Sequence[str]]
A set of URLs that are valid to call back from Auth0 when authenticating users
oidc_logout : typing.Optional[ClientOidcBackchannelLogoutSettings]
oidc_backchannel_logout : typing.Optional[ClientOidcBackchannelLogoutSettings]
Configuration for OIDC backchannel logout (deprecated, in favor of oidc_logout)
session_transfer : typing.Optional[ClientSessionTransferConfiguration]
allowed_origins : typing.Optional[typing.Sequence[str]]
A set of URLs that represents valid origins for CORS
web_origins : typing.Optional[typing.Sequence[str]]
A set of URLs that represents valid web origins for use with web message response mode
grant_types : typing.Optional[typing.Sequence[str]]
A set of grant types that the client is authorized to use. Can include `authorization_code`, `implicit`, `refresh_token`, `client_credentials`, `password`, `http://auth0.com/oauth/grant-type/password-realm`, `http://auth0.com/oauth/grant-type/mfa-oob`, `http://auth0.com/oauth/grant-type/mfa-otp`, `http://auth0.com/oauth/grant-type/mfa-recovery-code`, `urn:openid:params:grant-type:ciba`, `urn:ietf:params:oauth:grant-type:device_code`, and `urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token`.
client_aliases : typing.Optional[typing.Sequence[str]]
List of audiences for SAML protocol
allowed_clients : typing.Optional[typing.Sequence[str]]
Ids of clients that will be allowed to perform delegation requests. Clients that will be allowed to make delegation request. By default, all your clients will be allowed. This field allows you to specify specific clients
allowed_logout_urls : typing.Optional[typing.Sequence[str]]
URLs that are valid to redirect to after logout from Auth0
jwt_configuration : typing.Optional[ClientJwtConfiguration]
An object that holds settings related to how JWTs are created
encryption_key : typing.Optional[ClientEncryptionKey]
The client's encryption key
sso : typing.Optional[bool]
true to use Auth0 instead of the IdP to do Single Sign On, false otherwise (default: false)
cross_origin_authentication : typing.Optional[bool]
true if this client can be used to make cross-origin authentication requests, false otherwise if cross origin is disabled
cross_origin_loc : typing.Optional[str]
URL for the location in your site where the cross origin verification takes place for the cross-origin auth flow when performing Auth in your own domain instead of Auth0 hosted login page.
sso_disabled : typing.Optional[bool]
true to disable Single Sign On, false otherwise (default: false)
custom_login_page_on : typing.Optional[bool]
true if the custom login page is to be used, false otherwise.
token_endpoint_auth_method : typing.Optional[ClientTokenEndpointAuthMethodOrNullEnum]
is_token_endpoint_ip_header_trusted : typing.Optional[bool]
If true, trust that the IP specified in the `auth0-forwarded-for` header is the end-user's IP for brute-force-protection on token endpoint.
app_type : typing.Optional[ClientAppTypeEnum]
is_first_party : typing.Optional[bool]
Whether this client a first party client or not
oidc_conformant : typing.Optional[bool]
Whether this client will conform to strict OIDC specifications
custom_login_page : typing.Optional[str]
The content (HTML, CSS, JS) of the custom login page
custom_login_page_preview : typing.Optional[str]
token_quota : typing.Optional[UpdateTokenQuota]
identity_assertion_authorization_grant : typing.Optional[UpdateIdentityAssertionAuthorizationGrant]
form_template : typing.Optional[str]
Form template for WS-Federation protocol
addons : typing.Optional[ClientAddons]
client_metadata : typing.Optional[ClientMetadata]
mobile : typing.Optional[ClientMobile]
Configuration related to native mobile apps
initiate_login_uri : typing.Optional[str]
Initiate login uri, must be https
native_social_login : typing.Optional[NativeSocialLoginPatch]
fedcm_login : typing.Optional[FedCmLoginPatch]
refresh_token : typing.Optional[ClientRefreshTokenConfiguration]
default_organization : typing.Optional[ClientDefaultOrganization]
organization_usage : typing.Optional[ClientOrganizationUsagePatchEnum]
organization_require_behavior : typing.Optional[ClientOrganizationRequireBehaviorPatchEnum]
organization_discovery_methods : typing.Optional[typing.Sequence[ClientOrganizationDiscoveryEnum]]
Defines the available methods for organization discovery during the `pre_login_prompt`. Users can discover their organization either by `email`, `organization_name` or both.
client_authentication_methods : typing.Optional[ClientAuthenticationMethod]
require_pushed_authorization_requests : typing.Optional[bool]
Makes the use of Pushed Authorization Requests mandatory for this client
require_proof_of_possession : typing.Optional[bool]
Makes the use of Proof-of-Possession mandatory for this client
signed_request_object : typing.Optional[ClientSignedRequestObjectWithCredentialId]
token_vault_privileged_access : typing.Optional[ClientTokenVaultPrivilegedAccessWithCredentialId]
compliance_level : typing.Optional[ClientComplianceLevelEnum]
skip_non_verifiable_callback_uri_confirmation_prompt : typing.Optional[bool]
Controls whether a confirmation prompt is shown during login flows when the redirect URI uses non-verifiable callback URIs (for example, a custom URI schema such as `myapp://`, or `localhost`).
If set to true, a confirmation prompt will not be shown. We recommend that this is set to false for improved protection from malicious apps.
See https://auth0.com/docs/secure/security-guidance/measures-against-app-impersonation for more information.
token_exchange : typing.Optional[ClientTokenExchangeConfigurationOrNull]
par_request_expiry : typing.Optional[int]
Specifies how long, in seconds, a Pushed Authorization Request URI remains valid
express_configuration : typing.Optional[ExpressConfigurationOrNull]
my_organization_configuration : typing.Optional[ClientMyOrganizationPatchConfiguration]
async_approval_notification_channels : typing.Optional[ClientAsyncApprovalNotificationsChannelsApiPatchConfiguration]
third_party_security_mode : typing.Optional[ClientThirdPartySecurityModeEnum]
redirection_policy : typing.Optional[ClientRedirectionPolicyEnum]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
HttpResponse[UpdateClientResponseContent]
Client successfully updated.
"""
_response = self._client_wrapper.httpx_client.request(
f"clients/{encode_path_param(id)}",
method="PATCH",
json={
"name": name,
"description": description,
"client_secret": client_secret,
"logo_uri": logo_uri,
"callbacks": callbacks,
"oidc_logout": convert_and_respect_annotation_metadata(
object_=oidc_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
),
"oidc_backchannel_logout": convert_and_respect_annotation_metadata(
object_=oidc_backchannel_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
),
"session_transfer": convert_and_respect_annotation_metadata(
object_=session_transfer,
annotation=typing.Optional[ClientSessionTransferConfiguration],
direction="write",
),
"allowed_origins": allowed_origins,
"web_origins": web_origins,
"grant_types": grant_types,
"client_aliases": client_aliases,
"allowed_clients": allowed_clients,
"allowed_logout_urls": allowed_logout_urls,
"jwt_configuration": convert_and_respect_annotation_metadata(
object_=jwt_configuration, annotation=ClientJwtConfiguration, direction="write"
),
"encryption_key": convert_and_respect_annotation_metadata(
object_=encryption_key, annotation=typing.Optional[ClientEncryptionKey], direction="write"
),
"sso": sso,
"cross_origin_authentication": cross_origin_authentication,
"cross_origin_loc": cross_origin_loc,
"sso_disabled": sso_disabled,
"custom_login_page_on": custom_login_page_on,
"token_endpoint_auth_method": token_endpoint_auth_method,
"is_token_endpoint_ip_header_trusted": is_token_endpoint_ip_header_trusted,
"app_type": app_type,
"is_first_party": is_first_party,
"oidc_conformant": oidc_conformant,
"custom_login_page": custom_login_page,
"custom_login_page_preview": custom_login_page_preview,
"token_quota": convert_and_respect_annotation_metadata(
object_=token_quota, annotation=typing.Optional[UpdateTokenQuota], direction="write"
),
"identity_assertion_authorization_grant": convert_and_respect_annotation_metadata(
object_=identity_assertion_authorization_grant,
annotation=typing.Optional[UpdateIdentityAssertionAuthorizationGrant],
direction="write",
),
"form_template": form_template,
"addons": convert_and_respect_annotation_metadata(
object_=addons, annotation=ClientAddons, direction="write"
),
"client_metadata": client_metadata,
"mobile": convert_and_respect_annotation_metadata(
object_=mobile, annotation=ClientMobile, direction="write"
),
"initiate_login_uri": initiate_login_uri,
"native_social_login": convert_and_respect_annotation_metadata(
object_=native_social_login, annotation=typing.Optional[NativeSocialLoginPatch], direction="write"
),
"fedcm_login": convert_and_respect_annotation_metadata(
object_=fedcm_login, annotation=typing.Optional[FedCmLoginPatch], direction="write"
),
"refresh_token": convert_and_respect_annotation_metadata(
object_=refresh_token,
annotation=typing.Optional[ClientRefreshTokenConfiguration],
direction="write",
),
"default_organization": convert_and_respect_annotation_metadata(
object_=default_organization,
annotation=typing.Optional[ClientDefaultOrganization],
direction="write",
),
"organization_usage": organization_usage,
"organization_require_behavior": organization_require_behavior,
"organization_discovery_methods": organization_discovery_methods,
"client_authentication_methods": convert_and_respect_annotation_metadata(
object_=client_authentication_methods,
annotation=typing.Optional[ClientAuthenticationMethod],
direction="write",
),
"require_pushed_authorization_requests": require_pushed_authorization_requests,
"require_proof_of_possession": require_proof_of_possession,
"signed_request_object": convert_and_respect_annotation_metadata(
object_=signed_request_object,
annotation=ClientSignedRequestObjectWithCredentialId,
direction="write",
),
"token_vault_privileged_access": convert_and_respect_annotation_metadata(
object_=token_vault_privileged_access,
annotation=ClientTokenVaultPrivilegedAccessWithCredentialId,
direction="write",
),
"compliance_level": compliance_level,
"skip_non_verifiable_callback_uri_confirmation_prompt": skip_non_verifiable_callback_uri_confirmation_prompt,
"token_exchange": convert_and_respect_annotation_metadata(
object_=token_exchange,
annotation=typing.Optional[ClientTokenExchangeConfigurationOrNull],
direction="write",
),
"par_request_expiry": par_request_expiry,
"express_configuration": convert_and_respect_annotation_metadata(
object_=express_configuration,
annotation=typing.Optional[ExpressConfigurationOrNull],
direction="write",
),
"my_organization_configuration": convert_and_respect_annotation_metadata(
object_=my_organization_configuration,
annotation=typing.Optional[ClientMyOrganizationPatchConfiguration],
direction="write",
),
"async_approval_notification_channels": async_approval_notification_channels,
"third_party_security_mode": third_party_security_mode,
"redirection_policy": redirection_policy,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
UpdateClientResponseContent,
parse_obj_as(
type_=UpdateClientResponseContent, # type: ignore
object_=_response.json(),
),
)
return HttpResponse(response=_response, data=_data)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 401:
raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 403:
raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 404:
raise NotFoundError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
def rotate_secret(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[RotateClientSecretResponseContent]:
"""
Rotate a client secret.
This endpoint cannot be used with clients configured with Private Key JWT authentication method (client_authentication_methods configured with private_key_jwt). The generated secret is NOT base64 encoded.
For more information, read [Rotate Client Secrets](https://www.auth0.com/docs/get-started/applications/rotate-client-secret).
Parameters
----------
id : str
ID of the client that will rotate secrets.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
HttpResponse[RotateClientSecretResponseContent]
Secret successfully rotated.
"""
_response = self._client_wrapper.httpx_client.request(
f"clients/{encode_path_param(id)}/rotate-secret",
method="POST",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
RotateClientSecretResponseContent,
parse_obj_as(
type_=RotateClientSecretResponseContent, # type: ignore
object_=_response.json(),
),
)
return HttpResponse(response=_response, data=_data)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 401:
raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 403:
raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 404:
raise NotFoundError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
class AsyncRawClientsClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper
async def list(
self,
*,
fields: typing.Optional[str] = None,
include_fields: typing.Optional[bool] = None,
page: typing.Optional[int] = 0,
per_page: typing.Optional[int] = 50,
include_totals: typing.Optional[bool] = True,
is_global: typing.Optional[bool] = None,
is_first_party: typing.Optional[bool] = None,
app_type: typing.Optional[str] = None,
external_client_id: typing.Optional[str] = None,
q: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncPager[Client, ListClientsOffsetPaginatedResponseContent]:
"""
Retrieve clients (applications and SSO integrations) matching provided filters. A list of fields to include or exclude may also be specified.
For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on).
- The following can be retrieved with any scope:
`client_id`, `app_type`, `name`, and `description`.
- The following properties can only be retrieved with the `read:clients` or
`read:client_keys` scope:
`callbacks`, `oidc_logout`, `allowed_origins`,
`web_origins`, `tenant`, `global`, `config_route`,
`callback_url_template`, `jwt_configuration`,
`jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`,
`jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`,
`logo_uri`, `allowed_clients`, `owners`, `custom_login_page`,
`custom_login_page_off`, `sso`, `addons`, `form_template`,
`custom_login_page_codeview`, `resource_servers`, `client_metadata`,
`mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`,
`token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`,
`is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`,
`refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`,
`refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`,
`organization_require_behavior`.
- The following properties can only be retrieved with the
`read:client_keys` or `read:client_credentials` scope:
`encryption_key`, `encryption_key.pub`, `encryption_key.cert`,
`client_secret`, `client_authentication_methods` and `signing_key`.
Parameters
----------
fields : typing.Optional[str]
Comma-separated list of fields to include or exclude (based on value provided for include_fields) in the result. Leave empty to retrieve all fields.
include_fields : typing.Optional[bool]
Whether specified fields are to be included (true) or excluded (false).
page : typing.Optional[int]
Page index of the results to return. First page is 0.
per_page : typing.Optional[int]
Number of results per page. Default value is 50, maximum value is 100
include_totals : typing.Optional[bool]
Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).
is_global : typing.Optional[bool]
Optional filter on the global client parameter.
is_first_party : typing.Optional[bool]
Optional filter on whether or not a client is a first-party client.
app_type : typing.Optional[str]
Optional filter by a comma-separated list of application types.
external_client_id : typing.Optional[str]
Optional filter by the Client ID Metadata Document URI for CIMD-registered clients.
q : typing.Optional[str]
Advanced Query in Lucene syntax.true to disable Single Sign On, false otherwise (default: false)
custom_login_page_on : typing.Optional[bool]
true if the custom login page is to be used, false otherwise. Defaults to true
custom_login_page : typing.Optional[str]
The content (HTML, CSS, JS) of the custom login page.
custom_login_page_preview : typing.Optional[str]
The content (HTML, CSS, JS) of the custom login page. (Used on Previews)
form_template : typing.Optional[str]
HTML form template to be used for WS-Federation.
addons : typing.Optional[ClientAddons]
client_metadata : typing.Optional[ClientMetadata]
mobile : typing.Optional[ClientMobile]
initiate_login_uri : typing.Optional[str]
Initiate login uri, must be https
native_social_login : typing.Optional[NativeSocialLogin]
fedcm_login : typing.Optional[FedCmLogin]
refresh_token : typing.Optional[ClientRefreshTokenConfiguration]
default_organization : typing.Optional[ClientDefaultOrganization]
organization_usage : typing.Optional[ClientOrganizationUsageEnum]
organization_require_behavior : typing.Optional[ClientOrganizationRequireBehaviorEnum]
organization_discovery_methods : typing.Optional[typing.Sequence[ClientOrganizationDiscoveryEnum]]
Defines the available methods for organization discovery during the `pre_login_prompt`. Users can discover their organization either by `email`, `organization_name` or both.
client_authentication_methods : typing.Optional[ClientCreateAuthenticationMethod]
require_pushed_authorization_requests : typing.Optional[bool]
Makes the use of Pushed Authorization Requests mandatory for this client
require_proof_of_possession : typing.Optional[bool]
Makes the use of Proof-of-Possession mandatory for this client
signed_request_object : typing.Optional[ClientSignedRequestObjectWithPublicKey]
token_vault_privileged_access : typing.Optional[ClientTokenVaultPrivilegedAccessWithPublicKey]
compliance_level : typing.Optional[ClientComplianceLevelEnum]
skip_non_verifiable_callback_uri_confirmation_prompt : typing.Optional[bool]
Controls whether a confirmation prompt is shown during login flows when the redirect URI uses non-verifiable callback URIs (for example, a custom URI schema such as `myapp://`, or `localhost`).
If set to true, a confirmation prompt will not be shown. We recommend that this is set to false for improved protection from malicious apps.
See https://auth0.com/docs/secure/security-guidance/measures-against-app-impersonation for more information.
token_exchange : typing.Optional[ClientTokenExchangeConfiguration]
par_request_expiry : typing.Optional[int]
Specifies how long, in seconds, a Pushed Authorization Request URI remains valid
token_quota : typing.Optional[CreateTokenQuota]
resource_server_identifier : typing.Optional[str]
The identifier of the resource server that this client is linked to.
identity_assertion_authorization_grant : typing.Optional[CreateIdentityAssertionAuthorizationGrant]
third_party_security_mode : typing.Optional[ClientThirdPartySecurityModeEnum]
redirection_policy : typing.Optional[ClientRedirectionPolicyEnum]
express_configuration : typing.Optional[ExpressConfiguration]
my_organization_configuration : typing.Optional[ClientMyOrganizationPostConfiguration]
async_approval_notification_channels : typing.Optional[ClientAsyncApprovalNotificationsChannelsApiPostConfiguration]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
AsyncHttpResponse[CreateClientResponseContent]
Client successfully created.
"""
_response = await self._client_wrapper.httpx_client.request(
"clients",
method="POST",
json={
"name": name,
"description": description,
"logo_uri": logo_uri,
"callbacks": callbacks,
"oidc_logout": convert_and_respect_annotation_metadata(
object_=oidc_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
),
"oidc_backchannel_logout": convert_and_respect_annotation_metadata(
object_=oidc_backchannel_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
),
"session_transfer": convert_and_respect_annotation_metadata(
object_=session_transfer,
annotation=typing.Optional[ClientSessionTransferConfiguration],
direction="write",
),
"allowed_origins": allowed_origins,
"web_origins": web_origins,
"client_aliases": client_aliases,
"allowed_clients": allowed_clients,
"allowed_logout_urls": allowed_logout_urls,
"grant_types": grant_types,
"token_endpoint_auth_method": token_endpoint_auth_method,
"is_token_endpoint_ip_header_trusted": is_token_endpoint_ip_header_trusted,
"app_type": app_type,
"is_first_party": is_first_party,
"oidc_conformant": oidc_conformant,
"jwt_configuration": convert_and_respect_annotation_metadata(
object_=jwt_configuration, annotation=ClientJwtConfiguration, direction="write"
),
"encryption_key": convert_and_respect_annotation_metadata(
object_=encryption_key, annotation=typing.Optional[ClientEncryptionKey], direction="write"
),
"sso": sso,
"cross_origin_authentication": cross_origin_authentication,
"cross_origin_loc": cross_origin_loc,
"sso_disabled": sso_disabled,
"custom_login_page_on": custom_login_page_on,
"custom_login_page": custom_login_page,
"custom_login_page_preview": custom_login_page_preview,
"form_template": form_template,
"addons": convert_and_respect_annotation_metadata(
object_=addons, annotation=ClientAddons, direction="write"
),
"client_metadata": client_metadata,
"mobile": convert_and_respect_annotation_metadata(
object_=mobile, annotation=ClientMobile, direction="write"
),
"initiate_login_uri": initiate_login_uri,
"native_social_login": convert_and_respect_annotation_metadata(
object_=native_social_login, annotation=NativeSocialLogin, direction="write"
),
"fedcm_login": convert_and_respect_annotation_metadata(
object_=fedcm_login, annotation=FedCmLogin, direction="write"
),
"refresh_token": convert_and_respect_annotation_metadata(
object_=refresh_token,
annotation=typing.Optional[ClientRefreshTokenConfiguration],
direction="write",
),
"default_organization": convert_and_respect_annotation_metadata(
object_=default_organization,
annotation=typing.Optional[ClientDefaultOrganization],
direction="write",
),
"organization_usage": organization_usage,
"organization_require_behavior": organization_require_behavior,
"organization_discovery_methods": organization_discovery_methods,
"client_authentication_methods": convert_and_respect_annotation_metadata(
object_=client_authentication_methods,
annotation=ClientCreateAuthenticationMethod,
direction="write",
),
"require_pushed_authorization_requests": require_pushed_authorization_requests,
"require_proof_of_possession": require_proof_of_possession,
"signed_request_object": convert_and_respect_annotation_metadata(
object_=signed_request_object, annotation=ClientSignedRequestObjectWithPublicKey, direction="write"
),
"token_vault_privileged_access": convert_and_respect_annotation_metadata(
object_=token_vault_privileged_access,
annotation=ClientTokenVaultPrivilegedAccessWithPublicKey,
direction="write",
),
"compliance_level": compliance_level,
"skip_non_verifiable_callback_uri_confirmation_prompt": skip_non_verifiable_callback_uri_confirmation_prompt,
"token_exchange": convert_and_respect_annotation_metadata(
object_=token_exchange, annotation=ClientTokenExchangeConfiguration, direction="write"
),
"par_request_expiry": par_request_expiry,
"token_quota": convert_and_respect_annotation_metadata(
object_=token_quota, annotation=CreateTokenQuota, direction="write"
),
"resource_server_identifier": resource_server_identifier,
"identity_assertion_authorization_grant": convert_and_respect_annotation_metadata(
object_=identity_assertion_authorization_grant,
annotation=CreateIdentityAssertionAuthorizationGrant,
direction="write",
),
"third_party_security_mode": third_party_security_mode,
"redirection_policy": redirection_policy,
"express_configuration": convert_and_respect_annotation_metadata(
object_=express_configuration, annotation=ExpressConfiguration, direction="write"
),
"my_organization_configuration": convert_and_respect_annotation_metadata(
object_=my_organization_configuration,
annotation=ClientMyOrganizationPostConfiguration,
direction="write",
),
"async_approval_notification_channels": async_approval_notification_channels,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
CreateClientResponseContent,
parse_obj_as(
type_=CreateClientResponseContent, # type: ignore
object_=_response.json(),
),
)
return AsyncHttpResponse(response=_response, data=_data)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 401:
raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 403:
raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 404:
raise NotFoundError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 409:
raise ConflictError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
async def preview_cimd_metadata(
self, *, external_client_id: str, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[PreviewCimdMetadataResponseContent]:
"""
Fetches and validates a Client ID Metadata Document without creating a client.
Returns the raw metadata and how it would be mapped to Auth0 client fields.
This endpoint is useful for testing metadata URIs before creating CIMD clients.
Parameters
----------
external_client_id : str
URL to the Client ID Metadata Document
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
AsyncHttpResponse[PreviewCimdMetadataResponseContent]
Metadata successfully fetched and validated, or retrieval error returned with errors array.
"""
_response = await self._client_wrapper.httpx_client.request(
"clients/cimd/preview",
method="POST",
json={
"external_client_id": external_client_id,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
PreviewCimdMetadataResponseContent,
parse_obj_as(
type_=PreviewCimdMetadataResponseContent, # type: ignore
object_=_response.json(),
),
)
return AsyncHttpResponse(response=_response, data=_data)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 401:
raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 403:
raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 500:
raise InternalServerError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
async def register_cimd_client(
self, *, external_client_id: str, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[RegisterCimdClientResponseContent]:
"""
Idempotent registration for Client ID Metadata Document (CIMD) clients.
Uses external_client_id as the unique identifier for upsert operations.
**Create:** Returns 201 when a new client is created (requires `create:clients` scope).
**Update:** Returns 200 when an existing client is updated (requires `update:clients` scope).
This endpoint automatically:
- Fetches and validates the metadata document
- Maps CIMD fields to Auth0 client configuration
- Creates/rotates credentials from the JWKS
- Enforces CIMD security policies (HTTPS-only, no shared secrets)
Parameters
----------
external_client_id : str
URL to the Client ID Metadata Document. Acts as the unique identifier for upsert operations.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
AsyncHttpResponse[RegisterCimdClientResponseContent]
CIMD client successfully updated (idempotent).
"""
_response = await self._client_wrapper.httpx_client.request(
"clients/cimd/register",
method="POST",
json={
"external_client_id": external_client_id,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
RegisterCimdClientResponseContent,
parse_obj_as(
type_=RegisterCimdClientResponseContent, # type: ignore
object_=_response.json(),
),
)
return AsyncHttpResponse(response=_response, data=_data)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 401:
raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 403:
raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 500:
raise InternalServerError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
async def get(
self,
id: str,
*,
fields: typing.Optional[str] = None,
include_fields: typing.Optional[bool] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetClientResponseContent]:
"""
Retrieve client details by ID. Clients are SSO connections or Applications linked with your Auth0 tenant. A list of fields to include or exclude may also be specified.
For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on).
- The following properties can be retrieved with any of the scopes:
`client_id`, `app_type`, `name`, and `description`.
- The following properties can only be retrieved with the `read:clients` or
`read:client_keys` scopes:
`callbacks`, `oidc_logout`, `allowed_origins`,
`web_origins`, `tenant`, `global`, `config_route`,
`callback_url_template`, `jwt_configuration`,
`jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`,
`jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`,
`logo_uri`, `allowed_clients`, `owners`, `custom_login_page`,
`custom_login_page_off`, `sso`, `addons`, `form_template`,
`custom_login_page_codeview`, `resource_servers`, `client_metadata`,
`mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`,
`token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`,
`is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`,
`refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`,
`refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`,
`organization_require_behavior`.
- The following properties can only be retrieved with the `read:client_keys` or `read:client_credentials` scopes:
`encryption_key`, `encryption_key.pub`, `encryption_key.cert`,
`client_secret`, `client_authentication_methods` and `signing_key`.
Parameters
----------
id : str
ID of the client to retrieve.
fields : typing.Optional[str]
Comma-separated list of fields to include or exclude (based on value provided for include_fields) in the result. Leave empty to retrieve all fields.
include_fields : typing.Optional[bool]
Whether specified fields are to be included (true) or excluded (false).
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
AsyncHttpResponse[GetClientResponseContent]
Client successfully retrieved.
"""
_response = await self._client_wrapper.httpx_client.request(
f"clients/{encode_path_param(id)}",
method="GET",
params={
"fields": fields,
"include_fields": include_fields,
},
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
GetClientResponseContent,
parse_obj_as(
type_=GetClientResponseContent, # type: ignore
object_=_response.json(),
),
)
return AsyncHttpResponse(response=_response, data=_data)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 401:
raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 403:
raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 404:
raise NotFoundError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
async def delete(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[None]:
"""
Delete a client and related configuration (rules, connections, etc).
Parameters
----------
id : str
ID of the client to delete.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
AsyncHttpResponse[None]
"""
_response = await self._client_wrapper.httpx_client.request(
f"clients/{encode_path_param(id)}",
method="DELETE",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return AsyncHttpResponse(response=_response, data=None)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 401:
raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 403:
raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
async def update(
self,
id: str,
*,
name: typing.Optional[str] = OMIT,
description: typing.Optional[str] = OMIT,
client_secret: typing.Optional[str] = OMIT,
logo_uri: typing.Optional[str] = OMIT,
callbacks: typing.Optional[typing.Sequence[str]] = OMIT,
oidc_logout: typing.Optional[ClientOidcBackchannelLogoutSettings] = OMIT,
oidc_backchannel_logout: typing.Optional[ClientOidcBackchannelLogoutSettings] = OMIT,
session_transfer: typing.Optional[ClientSessionTransferConfiguration] = OMIT,
allowed_origins: typing.Optional[typing.Sequence[str]] = OMIT,
web_origins: typing.Optional[typing.Sequence[str]] = OMIT,
grant_types: typing.Optional[typing.Sequence[str]] = OMIT,
client_aliases: typing.Optional[typing.Sequence[str]] = OMIT,
allowed_clients: typing.Optional[typing.Sequence[str]] = OMIT,
allowed_logout_urls: typing.Optional[typing.Sequence[str]] = OMIT,
jwt_configuration: typing.Optional[ClientJwtConfiguration] = OMIT,
encryption_key: typing.Optional[ClientEncryptionKey] = OMIT,
sso: typing.Optional[bool] = OMIT,
cross_origin_authentication: typing.Optional[bool] = OMIT,
cross_origin_loc: typing.Optional[str] = OMIT,
sso_disabled: typing.Optional[bool] = OMIT,
custom_login_page_on: typing.Optional[bool] = OMIT,
token_endpoint_auth_method: typing.Optional[ClientTokenEndpointAuthMethodOrNullEnum] = OMIT,
is_token_endpoint_ip_header_trusted: typing.Optional[bool] = OMIT,
app_type: typing.Optional[ClientAppTypeEnum] = OMIT,
is_first_party: typing.Optional[bool] = OMIT,
oidc_conformant: typing.Optional[bool] = OMIT,
custom_login_page: typing.Optional[str] = OMIT,
custom_login_page_preview: typing.Optional[str] = OMIT,
token_quota: typing.Optional[UpdateTokenQuota] = OMIT,
identity_assertion_authorization_grant: typing.Optional[UpdateIdentityAssertionAuthorizationGrant] = OMIT,
form_template: typing.Optional[str] = OMIT,
addons: typing.Optional[ClientAddons] = OMIT,
client_metadata: typing.Optional[ClientMetadata] = OMIT,
mobile: typing.Optional[ClientMobile] = OMIT,
initiate_login_uri: typing.Optional[str] = OMIT,
native_social_login: typing.Optional[NativeSocialLoginPatch] = OMIT,
fedcm_login: typing.Optional[FedCmLoginPatch] = OMIT,
refresh_token: typing.Optional[ClientRefreshTokenConfiguration] = OMIT,
default_organization: typing.Optional[ClientDefaultOrganization] = OMIT,
organization_usage: typing.Optional[ClientOrganizationUsagePatchEnum] = OMIT,
organization_require_behavior: typing.Optional[ClientOrganizationRequireBehaviorPatchEnum] = OMIT,
organization_discovery_methods: typing.Optional[typing.Sequence[ClientOrganizationDiscoveryEnum]] = OMIT,
client_authentication_methods: typing.Optional[ClientAuthenticationMethod] = OMIT,
require_pushed_authorization_requests: typing.Optional[bool] = OMIT,
require_proof_of_possession: typing.Optional[bool] = OMIT,
signed_request_object: typing.Optional[ClientSignedRequestObjectWithCredentialId] = OMIT,
token_vault_privileged_access: typing.Optional[ClientTokenVaultPrivilegedAccessWithCredentialId] = OMIT,
compliance_level: typing.Optional[ClientComplianceLevelEnum] = OMIT,
skip_non_verifiable_callback_uri_confirmation_prompt: typing.Optional[bool] = OMIT,
token_exchange: typing.Optional[ClientTokenExchangeConfigurationOrNull] = OMIT,
par_request_expiry: typing.Optional[int] = OMIT,
express_configuration: typing.Optional[ExpressConfigurationOrNull] = OMIT,
my_organization_configuration: typing.Optional[ClientMyOrganizationPatchConfiguration] = OMIT,
async_approval_notification_channels: typing.Optional[
ClientAsyncApprovalNotificationsChannelsApiPatchConfiguration
] = OMIT,
third_party_security_mode: typing.Optional[ClientThirdPartySecurityModeEnum] = OMIT,
redirection_policy: typing.Optional[ClientRedirectionPolicyEnum] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[UpdateClientResponseContent]:
"""
Updates a client's settings. For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on).
Notes:
- The `client_secret` and `signing_key` attributes can only be updated with the `update:client_keys` scope.
- The `client_authentication_methods` and `token_endpoint_auth_method` properties are mutually exclusive. Use `client_authentication_methods` to configure the client with Private Key JWT authentication method. Otherwise, use `token_endpoint_auth_method` to configure the client with client secret (basic or post) or with no authentication method (none).
- When using `client_authentication_methods` to configure the client with Private Key JWT authentication method, only specify the credential IDs that were generated when creating the credentials on the client.
- To configure `client_authentication_methods`, the `update:client_credentials` scope is required.
- To configure `client_authentication_methods`, the property `jwt_configuration.alg` must be set to RS256.
- To change a client's `is_first_party` property to `false`, the `organization_usage` and `organization_require_behavior` properties must be unset.
Parameters
----------
id : str
ID of the client to update.
name : typing.Optional[str]
The name of the client. Must contain at least one character. Does not allow '<' or '>'.
description : typing.Optional[str]
Free text description of the purpose of the Client. (Max character length: 140)
client_secret : typing.Optional[str]
The secret used to sign tokens for the client
logo_uri : typing.Optional[str]
The URL of the client logo (recommended size: 150x150)
callbacks : typing.Optional[typing.Sequence[str]]
A set of URLs that are valid to call back from Auth0 when authenticating users
oidc_logout : typing.Optional[ClientOidcBackchannelLogoutSettings]
oidc_backchannel_logout : typing.Optional[ClientOidcBackchannelLogoutSettings]
Configuration for OIDC backchannel logout (deprecated, in favor of oidc_logout)
session_transfer : typing.Optional[ClientSessionTransferConfiguration]
allowed_origins : typing.Optional[typing.Sequence[str]]
A set of URLs that represents valid origins for CORS
web_origins : typing.Optional[typing.Sequence[str]]
A set of URLs that represents valid web origins for use with web message response mode
grant_types : typing.Optional[typing.Sequence[str]]
A set of grant types that the client is authorized to use. Can include `authorization_code`, `implicit`, `refresh_token`, `client_credentials`, `password`, `http://auth0.com/oauth/grant-type/password-realm`, `http://auth0.com/oauth/grant-type/mfa-oob`, `http://auth0.com/oauth/grant-type/mfa-otp`, `http://auth0.com/oauth/grant-type/mfa-recovery-code`, `urn:openid:params:grant-type:ciba`, `urn:ietf:params:oauth:grant-type:device_code`, and `urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token`.
client_aliases : typing.Optional[typing.Sequence[str]]
List of audiences for SAML protocol
allowed_clients : typing.Optional[typing.Sequence[str]]
Ids of clients that will be allowed to perform delegation requests. Clients that will be allowed to make delegation request. By default, all your clients will be allowed. This field allows you to specify specific clients
allowed_logout_urls : typing.Optional[typing.Sequence[str]]
URLs that are valid to redirect to after logout from Auth0
jwt_configuration : typing.Optional[ClientJwtConfiguration]
An object that holds settings related to how JWTs are created
encryption_key : typing.Optional[ClientEncryptionKey]
The client's encryption key
sso : typing.Optional[bool]
true to use Auth0 instead of the IdP to do Single Sign On, false otherwise (default: false)
cross_origin_authentication : typing.Optional[bool]
true if this client can be used to make cross-origin authentication requests, false otherwise if cross origin is disabled
cross_origin_loc : typing.Optional[str]
URL for the location in your site where the cross origin verification takes place for the cross-origin auth flow when performing Auth in your own domain instead of Auth0 hosted login page.
sso_disabled : typing.Optional[bool]
true to disable Single Sign On, false otherwise (default: false)
custom_login_page_on : typing.Optional[bool]
true if the custom login page is to be used, false otherwise.
token_endpoint_auth_method : typing.Optional[ClientTokenEndpointAuthMethodOrNullEnum]
is_token_endpoint_ip_header_trusted : typing.Optional[bool]
If true, trust that the IP specified in the `auth0-forwarded-for` header is the end-user's IP for brute-force-protection on token endpoint.
app_type : typing.Optional[ClientAppTypeEnum]
is_first_party : typing.Optional[bool]
Whether this client a first party client or not
oidc_conformant : typing.Optional[bool]
Whether this client will conform to strict OIDC specifications
custom_login_page : typing.Optional[str]
The content (HTML, CSS, JS) of the custom login page
custom_login_page_preview : typing.Optional[str]
token_quota : typing.Optional[UpdateTokenQuota]
identity_assertion_authorization_grant : typing.Optional[UpdateIdentityAssertionAuthorizationGrant]
form_template : typing.Optional[str]
Form template for WS-Federation protocol
addons : typing.Optional[ClientAddons]
client_metadata : typing.Optional[ClientMetadata]
mobile : typing.Optional[ClientMobile]
Configuration related to native mobile apps
initiate_login_uri : typing.Optional[str]
Initiate login uri, must be https
native_social_login : typing.Optional[NativeSocialLoginPatch]
fedcm_login : typing.Optional[FedCmLoginPatch]
refresh_token : typing.Optional[ClientRefreshTokenConfiguration]
default_organization : typing.Optional[ClientDefaultOrganization]
organization_usage : typing.Optional[ClientOrganizationUsagePatchEnum]
organization_require_behavior : typing.Optional[ClientOrganizationRequireBehaviorPatchEnum]
organization_discovery_methods : typing.Optional[typing.Sequence[ClientOrganizationDiscoveryEnum]]
Defines the available methods for organization discovery during the `pre_login_prompt`. Users can discover their organization either by `email`, `organization_name` or both.
client_authentication_methods : typing.Optional[ClientAuthenticationMethod]
require_pushed_authorization_requests : typing.Optional[bool]
Makes the use of Pushed Authorization Requests mandatory for this client
require_proof_of_possession : typing.Optional[bool]
Makes the use of Proof-of-Possession mandatory for this client
signed_request_object : typing.Optional[ClientSignedRequestObjectWithCredentialId]
token_vault_privileged_access : typing.Optional[ClientTokenVaultPrivilegedAccessWithCredentialId]
compliance_level : typing.Optional[ClientComplianceLevelEnum]
skip_non_verifiable_callback_uri_confirmation_prompt : typing.Optional[bool]
Controls whether a confirmation prompt is shown during login flows when the redirect URI uses non-verifiable callback URIs (for example, a custom URI schema such as `myapp://`, or `localhost`).
If set to true, a confirmation prompt will not be shown. We recommend that this is set to false for improved protection from malicious apps.
See https://auth0.com/docs/secure/security-guidance/measures-against-app-impersonation for more information.
token_exchange : typing.Optional[ClientTokenExchangeConfigurationOrNull]
par_request_expiry : typing.Optional[int]
Specifies how long, in seconds, a Pushed Authorization Request URI remains valid
express_configuration : typing.Optional[ExpressConfigurationOrNull]
my_organization_configuration : typing.Optional[ClientMyOrganizationPatchConfiguration]
async_approval_notification_channels : typing.Optional[ClientAsyncApprovalNotificationsChannelsApiPatchConfiguration]
third_party_security_mode : typing.Optional[ClientThirdPartySecurityModeEnum]
redirection_policy : typing.Optional[ClientRedirectionPolicyEnum]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
AsyncHttpResponse[UpdateClientResponseContent]
Client successfully updated.
"""
_response = await self._client_wrapper.httpx_client.request(
f"clients/{encode_path_param(id)}",
method="PATCH",
json={
"name": name,
"description": description,
"client_secret": client_secret,
"logo_uri": logo_uri,
"callbacks": callbacks,
"oidc_logout": convert_and_respect_annotation_metadata(
object_=oidc_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
),
"oidc_backchannel_logout": convert_and_respect_annotation_metadata(
object_=oidc_backchannel_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
),
"session_transfer": convert_and_respect_annotation_metadata(
object_=session_transfer,
annotation=typing.Optional[ClientSessionTransferConfiguration],
direction="write",
),
"allowed_origins": allowed_origins,
"web_origins": web_origins,
"grant_types": grant_types,
"client_aliases": client_aliases,
"allowed_clients": allowed_clients,
"allowed_logout_urls": allowed_logout_urls,
"jwt_configuration": convert_and_respect_annotation_metadata(
object_=jwt_configuration, annotation=ClientJwtConfiguration, direction="write"
),
"encryption_key": convert_and_respect_annotation_metadata(
object_=encryption_key, annotation=typing.Optional[ClientEncryptionKey], direction="write"
),
"sso": sso,
"cross_origin_authentication": cross_origin_authentication,
"cross_origin_loc": cross_origin_loc,
"sso_disabled": sso_disabled,
"custom_login_page_on": custom_login_page_on,
"token_endpoint_auth_method": token_endpoint_auth_method,
"is_token_endpoint_ip_header_trusted": is_token_endpoint_ip_header_trusted,
"app_type": app_type,
"is_first_party": is_first_party,
"oidc_conformant": oidc_conformant,
"custom_login_page": custom_login_page,
"custom_login_page_preview": custom_login_page_preview,
"token_quota": convert_and_respect_annotation_metadata(
object_=token_quota, annotation=typing.Optional[UpdateTokenQuota], direction="write"
),
"identity_assertion_authorization_grant": convert_and_respect_annotation_metadata(
object_=identity_assertion_authorization_grant,
annotation=typing.Optional[UpdateIdentityAssertionAuthorizationGrant],
direction="write",
),
"form_template": form_template,
"addons": convert_and_respect_annotation_metadata(
object_=addons, annotation=ClientAddons, direction="write"
),
"client_metadata": client_metadata,
"mobile": convert_and_respect_annotation_metadata(
object_=mobile, annotation=ClientMobile, direction="write"
),
"initiate_login_uri": initiate_login_uri,
"native_social_login": convert_and_respect_annotation_metadata(
object_=native_social_login, annotation=typing.Optional[NativeSocialLoginPatch], direction="write"
),
"fedcm_login": convert_and_respect_annotation_metadata(
object_=fedcm_login, annotation=typing.Optional[FedCmLoginPatch], direction="write"
),
"refresh_token": convert_and_respect_annotation_metadata(
object_=refresh_token,
annotation=typing.Optional[ClientRefreshTokenConfiguration],
direction="write",
),
"default_organization": convert_and_respect_annotation_metadata(
object_=default_organization,
annotation=typing.Optional[ClientDefaultOrganization],
direction="write",
),
"organization_usage": organization_usage,
"organization_require_behavior": organization_require_behavior,
"organization_discovery_methods": organization_discovery_methods,
"client_authentication_methods": convert_and_respect_annotation_metadata(
object_=client_authentication_methods,
annotation=typing.Optional[ClientAuthenticationMethod],
direction="write",
),
"require_pushed_authorization_requests": require_pushed_authorization_requests,
"require_proof_of_possession": require_proof_of_possession,
"signed_request_object": convert_and_respect_annotation_metadata(
object_=signed_request_object,
annotation=ClientSignedRequestObjectWithCredentialId,
direction="write",
),
"token_vault_privileged_access": convert_and_respect_annotation_metadata(
object_=token_vault_privileged_access,
annotation=ClientTokenVaultPrivilegedAccessWithCredentialId,
direction="write",
),
"compliance_level": compliance_level,
"skip_non_verifiable_callback_uri_confirmation_prompt": skip_non_verifiable_callback_uri_confirmation_prompt,
"token_exchange": convert_and_respect_annotation_metadata(
object_=token_exchange,
annotation=typing.Optional[ClientTokenExchangeConfigurationOrNull],
direction="write",
),
"par_request_expiry": par_request_expiry,
"express_configuration": convert_and_respect_annotation_metadata(
object_=express_configuration,
annotation=typing.Optional[ExpressConfigurationOrNull],
direction="write",
),
"my_organization_configuration": convert_and_respect_annotation_metadata(
object_=my_organization_configuration,
annotation=typing.Optional[ClientMyOrganizationPatchConfiguration],
direction="write",
),
"async_approval_notification_channels": async_approval_notification_channels,
"third_party_security_mode": third_party_security_mode,
"redirection_policy": redirection_policy,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
UpdateClientResponseContent,
parse_obj_as(
type_=UpdateClientResponseContent, # type: ignore
object_=_response.json(),
),
)
return AsyncHttpResponse(response=_response, data=_data)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 401:
raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 403:
raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 404:
raise NotFoundError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
async def rotate_secret(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[RotateClientSecretResponseContent]:
"""
Rotate a client secret.
This endpoint cannot be used with clients configured with Private Key JWT authentication method (client_authentication_methods configured with private_key_jwt). The generated secret is NOT base64 encoded.
For more information, read [Rotate Client Secrets](https://www.auth0.com/docs/get-started/applications/rotate-client-secret).
Parameters
----------
id : str
ID of the client that will rotate secrets.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
AsyncHttpResponse[RotateClientSecretResponseContent]
Secret successfully rotated.
"""
_response = await self._client_wrapper.httpx_client.request(
f"clients/{encode_path_param(id)}/rotate-secret",
method="POST",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
RotateClientSecretResponseContent,
parse_obj_as(
type_=RotateClientSecretResponseContent, # type: ignore
object_=_response.json(),
),
)
return AsyncHttpResponse(response=_response, data=_data)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 401:
raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 403:
raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 404:
raise NotFoundError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)