Debian Codegraph @

src/auth0/management/clients/raw_client.py

raw symbols SCIP
1 # This file was auto-generated by Fern from our API Definition.
2
3 import typing
4 from json.decoder import JSONDecodeError
5
6 from ..core.api_error import ApiError
7 from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8 from ..core.http_response import AsyncHttpResponse, HttpResponse
9 from ..core.jsonable_encoder import encode_path_param
10 from ..core.pagination import AsyncPager, SyncPager
11 from ..core.parse_error import ParsingError
12 from ..core.pydantic_utilities import parse_obj_as
13 from ..core.request_options import RequestOptions
14 from ..core.serialization import convert_and_respect_annotation_metadata
15 from ..errors.bad_request_error import BadRequestError
16 from ..errors.conflict_error import ConflictError
17 from ..errors.forbidden_error import ForbiddenError
18 from ..errors.internal_server_error import InternalServerError
19 from ..errors.not_found_error import NotFoundError
20 from ..errors.too_many_requests_error import TooManyRequestsError
21 from ..errors.unauthorized_error import UnauthorizedError
22 from ..types.client import Client
23 from ..types.client_addons import ClientAddons
24 from ..types.client_app_type_enum import ClientAppTypeEnum
25 from ..types.client_async_approval_notifications_channels_api_patch_configuration import (
26 ClientAsyncApprovalNotificationsChannelsApiPatchConfiguration,
27 )
28 from ..types.client_async_approval_notifications_channels_api_post_configuration import (
29 ClientAsyncApprovalNotificationsChannelsApiPostConfiguration,
30 )
31 from ..types.client_authentication_method import ClientAuthenticationMethod
32 from ..types.client_compliance_level_enum import ClientComplianceLevelEnum
33 from ..types.client_create_authentication_method import ClientCreateAuthenticationMethod
34 from ..types.client_default_organization import ClientDefaultOrganization
35 from ..types.client_encryption_key import ClientEncryptionKey
36 from ..types.client_jwt_configuration import ClientJwtConfiguration
37 from ..types.client_metadata import ClientMetadata
38 from ..types.client_mobile import ClientMobile
39 from ..types.client_my_organization_patch_configuration import ClientMyOrganizationPatchConfiguration
40 from ..types.client_my_organization_post_configuration import ClientMyOrganizationPostConfiguration
41 from ..types.client_oidc_backchannel_logout_settings import ClientOidcBackchannelLogoutSettings
42 from ..types.client_organization_discovery_enum import ClientOrganizationDiscoveryEnum
43 from ..types.client_organization_require_behavior_enum import ClientOrganizationRequireBehaviorEnum
44 from ..types.client_organization_require_behavior_patch_enum import ClientOrganizationRequireBehaviorPatchEnum
45 from ..types.client_organization_usage_enum import ClientOrganizationUsageEnum
46 from ..types.client_organization_usage_patch_enum import ClientOrganizationUsagePatchEnum
47 from ..types.client_redirection_policy_enum import ClientRedirectionPolicyEnum
48 from ..types.client_refresh_token_configuration import ClientRefreshTokenConfiguration
49 from ..types.client_session_transfer_configuration import ClientSessionTransferConfiguration
50 from ..types.client_signed_request_object_with_credential_id import ClientSignedRequestObjectWithCredentialId
51 from ..types.client_signed_request_object_with_public_key import ClientSignedRequestObjectWithPublicKey
52 from ..types.client_third_party_security_mode_enum import ClientThirdPartySecurityModeEnum
53 from ..types.client_token_endpoint_auth_method_enum import ClientTokenEndpointAuthMethodEnum
54 from ..types.client_token_endpoint_auth_method_or_null_enum import ClientTokenEndpointAuthMethodOrNullEnum
55 from ..types.client_token_exchange_configuration import ClientTokenExchangeConfiguration
56 from ..types.client_token_exchange_configuration_or_null import ClientTokenExchangeConfigurationOrNull
57 from ..types.client_token_vault_privileged_access_with_credential_id import (
58 ClientTokenVaultPrivilegedAccessWithCredentialId,
59 )
60 from ..types.client_token_vault_privileged_access_with_public_key import ClientTokenVaultPrivilegedAccessWithPublicKey
61 from ..types.create_client_response_content import CreateClientResponseContent
62 from ..types.create_identity_assertion_authorization_grant import CreateIdentityAssertionAuthorizationGrant
63 from ..types.create_token_quota import CreateTokenQuota
64 from ..types.express_configuration import ExpressConfiguration
65 from ..types.express_configuration_or_null import ExpressConfigurationOrNull
66 from ..types.fed_cm_login import FedCmLogin
67 from ..types.fed_cm_login_patch import FedCmLoginPatch
68 from ..types.get_client_response_content import GetClientResponseContent
69 from ..types.list_clients_offset_paginated_response_content import ListClientsOffsetPaginatedResponseContent
70 from ..types.native_social_login import NativeSocialLogin
71 from ..types.native_social_login_patch import NativeSocialLoginPatch
72 from ..types.preview_cimd_metadata_response_content import PreviewCimdMetadataResponseContent
73 from ..types.register_cimd_client_response_content import RegisterCimdClientResponseContent
74 from ..types.rotate_client_secret_response_content import RotateClientSecretResponseContent
75 from ..types.update_client_response_content import UpdateClientResponseContent
76 from ..types.update_identity_assertion_authorization_grant import UpdateIdentityAssertionAuthorizationGrant
77 from ..types.update_token_quota import UpdateTokenQuota
78 from pydantic import ValidationError
79
80 # this is used as the default value for optional parameters
81 OMIT = typing.cast(typing.Any, ...)
82
83
84 class RawClientsClient:
85 def __init__(self, *, client_wrapper: SyncClientWrapper):
86 self._client_wrapper = client_wrapper
87
88 def list(
89 self,
90 *,
91 fields: typing.Optional[str] = None,
92 include_fields: typing.Optional[bool] = None,
93 page: typing.Optional[int] = 0,
94 per_page: typing.Optional[int] = 50,
95 include_totals: typing.Optional[bool] = True,
96 is_global: typing.Optional[bool] = None,
97 is_first_party: typing.Optional[bool] = None,
98 app_type: typing.Optional[str] = None,
99 external_client_id: typing.Optional[str] = None,
100 q: typing.Optional[str] = None,
101 request_options: typing.Optional[RequestOptions] = None,
102 ) -> SyncPager[Client, ListClientsOffsetPaginatedResponseContent]:
103 """
104 Retrieve clients (applications and SSO integrations) matching provided filters. A list of fields to include or exclude may also be specified.
105 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).
106
107 - The following can be retrieved with any scope:
108 `client_id`, `app_type`, `name`, and `description`.
109 - The following properties can only be retrieved with the `read:clients` or
110 `read:client_keys` scope:
111 `callbacks`, `oidc_logout`, `allowed_origins`,
112 `web_origins`, `tenant`, `global`, `config_route`,
113 `callback_url_template`, `jwt_configuration`,
114 `jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`,
115 `jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`,
116 `logo_uri`, `allowed_clients`, `owners`, `custom_login_page`,
117 `custom_login_page_off`, `sso`, `addons`, `form_template`,
118 `custom_login_page_codeview`, `resource_servers`, `client_metadata`,
119 `mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`,
120 `token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`,
121 `is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`,
122 `refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`,
123 `refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`,
124 `organization_require_behavior`.
125 - The following properties can only be retrieved with the
126 `read:client_keys` or `read:client_credentials` scope:
127 `encryption_key`, `encryption_key.pub`, `encryption_key.cert`,
128 `client_secret`, `client_authentication_methods` and `signing_key`.
129
130 Parameters
131 ----------
132 fields : typing.Optional[str]
133 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.
134
135 include_fields : typing.Optional[bool]
136 Whether specified fields are to be included (true) or excluded (false).
137
138 page : typing.Optional[int]
139 Page index of the results to return. First page is 0.
140
141 per_page : typing.Optional[int]
142 Number of results per page. Default value is 50, maximum value is 100
143
144 include_totals : typing.Optional[bool]
145 Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).
146
147 is_global : typing.Optional[bool]
148 Optional filter on the global client parameter.
149
150 is_first_party : typing.Optional[bool]
151 Optional filter on whether or not a client is a first-party client.
152
153 app_type : typing.Optional[str]
154 Optional filter by a comma-separated list of application types.
155
156 external_client_id : typing.Optional[str]
157 Optional filter by the <a href="https://drafts.oauth.net/draft-ietf-oauth-client-id-metadata-document/draft-ietf-oauth-client-id-metadata-document.html">Client ID Metadata Document</a> URI for CIMD-registered clients.
158
159 q : typing.Optional[str]
160 Advanced Query in <a href="https://lucene.apache.org/core/2_9_4/queryparsersyntax.html">Lucene</a> syntax.<br /><b>Permitted Queries</b>:<br /><ul><li><i>client_grant.organization_id:{organization_id}</i></li><li><i>client_grant.allow_any_organization:true</i></li></ul><b>Additional Restrictions</b>:<br /><ul><li>Cannot be used in combination with other filters</li><li>Requires use of the <i>from</i> and <i>take</i> paging parameters (checkpoint paginatinon)</li><li>Reduced rate limits apply. See <a href="https://auth0.com/docs/troubleshoot/customer-support/operational-policies/rate-limit-policy/rate-limit-configurations/enterprise-public">Rate Limit Configurations</a></li></ul><i><b>Note</b>: Recent updates may not be immediately reflected in query results</i>
161
162 request_options : typing.Optional[RequestOptions]
163 Request-specific configuration.
164
165 Returns
166 -------
167 SyncPager[Client, ListClientsOffsetPaginatedResponseContent]
168 Clients successfully retrieved.
169 """
170 page = page if page is not None else 0
171
172 _response = self._client_wrapper.httpx_client.request(
173 "clients",
174 method="GET",
175 params={
176 "fields": fields,
177 "include_fields": include_fields,
178 "page": page,
179 "per_page": per_page,
180 "include_totals": include_totals,
181 "is_global": is_global,
182 "is_first_party": is_first_party,
183 "app_type": app_type,
184 "external_client_id": external_client_id,
185 "q": q,
186 },
187 request_options=request_options,
188 )
189 try:
190 if 200 <= _response.status_code < 300:
191 _parsed_response = typing.cast(
192 ListClientsOffsetPaginatedResponseContent,
193 parse_obj_as(
194 type_=ListClientsOffsetPaginatedResponseContent, # type: ignore
195 object_=_response.json(),
196 ),
197 )
198 _items = _parsed_response.clients
199 _has_next = len(_items or []) > 0
200 _get_next = lambda: self.list(
201 fields=fields,
202 include_fields=include_fields,
203 page=page + 1,
204 per_page=per_page,
205 include_totals=include_totals,
206 is_global=is_global,
207 is_first_party=is_first_party,
208 app_type=app_type,
209 external_client_id=external_client_id,
210 q=q,
211 request_options=request_options,
212 )
213 return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
214 if _response.status_code == 400:
215 raise BadRequestError(
216 headers=dict(_response.headers),
217 body=typing.cast(
218 typing.Any,
219 parse_obj_as(
220 type_=typing.Any, # type: ignore
221 object_=_response.json(),
222 ),
223 ),
224 )
225 if _response.status_code == 401:
226 raise UnauthorizedError(
227 headers=dict(_response.headers),
228 body=typing.cast(
229 typing.Any,
230 parse_obj_as(
231 type_=typing.Any, # type: ignore
232 object_=_response.json(),
233 ),
234 ),
235 )
236 if _response.status_code == 403:
237 raise ForbiddenError(
238 headers=dict(_response.headers),
239 body=typing.cast(
240 typing.Any,
241 parse_obj_as(
242 type_=typing.Any, # type: ignore
243 object_=_response.json(),
244 ),
245 ),
246 )
247 if _response.status_code == 429:
248 raise TooManyRequestsError(
249 headers=dict(_response.headers),
250 body=typing.cast(
251 typing.Any,
252 parse_obj_as(
253 type_=typing.Any, # type: ignore
254 object_=_response.json(),
255 ),
256 ),
257 )
258 _response_json = _response.json()
259 except JSONDecodeError:
260 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
261 except ValidationError as e:
262 raise ParsingError(
263 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
264 )
265 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
266
267 def create(
268 self,
269 *,
270 name: str,
271 description: typing.Optional[str] = OMIT,
272 logo_uri: typing.Optional[str] = OMIT,
273 callbacks: typing.Optional[typing.Sequence[str]] = OMIT,
274 oidc_logout: typing.Optional[ClientOidcBackchannelLogoutSettings] = OMIT,
275 oidc_backchannel_logout: typing.Optional[ClientOidcBackchannelLogoutSettings] = OMIT,
276 session_transfer: typing.Optional[ClientSessionTransferConfiguration] = OMIT,
277 allowed_origins: typing.Optional[typing.Sequence[str]] = OMIT,
278 web_origins: typing.Optional[typing.Sequence[str]] = OMIT,
279 client_aliases: typing.Optional[typing.Sequence[str]] = OMIT,
280 allowed_clients: typing.Optional[typing.Sequence[str]] = OMIT,
281 allowed_logout_urls: typing.Optional[typing.Sequence[str]] = OMIT,
282 grant_types: typing.Optional[typing.Sequence[str]] = OMIT,
283 token_endpoint_auth_method: typing.Optional[ClientTokenEndpointAuthMethodEnum] = OMIT,
284 is_token_endpoint_ip_header_trusted: typing.Optional[bool] = OMIT,
285 app_type: typing.Optional[ClientAppTypeEnum] = OMIT,
286 is_first_party: typing.Optional[bool] = OMIT,
287 oidc_conformant: typing.Optional[bool] = OMIT,
288 jwt_configuration: typing.Optional[ClientJwtConfiguration] = OMIT,
289 encryption_key: typing.Optional[ClientEncryptionKey] = OMIT,
290 sso: typing.Optional[bool] = OMIT,
291 cross_origin_authentication: typing.Optional[bool] = OMIT,
292 cross_origin_loc: typing.Optional[str] = OMIT,
293 sso_disabled: typing.Optional[bool] = OMIT,
294 custom_login_page_on: typing.Optional[bool] = OMIT,
295 custom_login_page: typing.Optional[str] = OMIT,
296 custom_login_page_preview: typing.Optional[str] = OMIT,
297 form_template: typing.Optional[str] = OMIT,
298 addons: typing.Optional[ClientAddons] = OMIT,
299 client_metadata: typing.Optional[ClientMetadata] = OMIT,
300 mobile: typing.Optional[ClientMobile] = OMIT,
301 initiate_login_uri: typing.Optional[str] = OMIT,
302 native_social_login: typing.Optional[NativeSocialLogin] = OMIT,
303 fedcm_login: typing.Optional[FedCmLogin] = OMIT,
304 refresh_token: typing.Optional[ClientRefreshTokenConfiguration] = OMIT,
305 default_organization: typing.Optional[ClientDefaultOrganization] = OMIT,
306 organization_usage: typing.Optional[ClientOrganizationUsageEnum] = OMIT,
307 organization_require_behavior: typing.Optional[ClientOrganizationRequireBehaviorEnum] = OMIT,
308 organization_discovery_methods: typing.Optional[typing.Sequence[ClientOrganizationDiscoveryEnum]] = OMIT,
309 client_authentication_methods: typing.Optional[ClientCreateAuthenticationMethod] = OMIT,
310 require_pushed_authorization_requests: typing.Optional[bool] = OMIT,
311 require_proof_of_possession: typing.Optional[bool] = OMIT,
312 signed_request_object: typing.Optional[ClientSignedRequestObjectWithPublicKey] = OMIT,
313 token_vault_privileged_access: typing.Optional[ClientTokenVaultPrivilegedAccessWithPublicKey] = OMIT,
314 compliance_level: typing.Optional[ClientComplianceLevelEnum] = OMIT,
315 skip_non_verifiable_callback_uri_confirmation_prompt: typing.Optional[bool] = OMIT,
316 token_exchange: typing.Optional[ClientTokenExchangeConfiguration] = OMIT,
317 par_request_expiry: typing.Optional[int] = OMIT,
318 token_quota: typing.Optional[CreateTokenQuota] = OMIT,
319 resource_server_identifier: typing.Optional[str] = OMIT,
320 identity_assertion_authorization_grant: typing.Optional[CreateIdentityAssertionAuthorizationGrant] = OMIT,
321 third_party_security_mode: typing.Optional[ClientThirdPartySecurityModeEnum] = OMIT,
322 redirection_policy: typing.Optional[ClientRedirectionPolicyEnum] = OMIT,
323 express_configuration: typing.Optional[ExpressConfiguration] = OMIT,
324 my_organization_configuration: typing.Optional[ClientMyOrganizationPostConfiguration] = OMIT,
325 async_approval_notification_channels: typing.Optional[
326 ClientAsyncApprovalNotificationsChannelsApiPostConfiguration
327 ] = OMIT,
328 request_options: typing.Optional[RequestOptions] = None,
329 ) -> HttpResponse[CreateClientResponseContent]:
330 """
331 Create a new client (application or SSO integration). For more information, read [Create Applications](https://www.auth0.com/docs/get-started/auth0-overview/create-applications)
332 [API Endpoints for Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on/api-endpoints-for-single-sign-on).
333
334 Notes:
335 - We recommend leaving the `client_secret` parameter unspecified to allow the generation of a safe secret.
336 - The `client_authentication_methods` and `token_endpoint_auth_method` properties are mutually exclusive. Use
337 `client_authentication_methods` to configure the client with Private Key JWT authentication method. Otherwise, use `token_endpoint_auth_method`
338 to configure the client with client secret (basic or post) or with no authentication method (none).
339 - When using `client_authentication_methods` to configure the client with Private Key JWT authentication method, specify fully defined credentials.
340 These credentials will be automatically enabled for Private Key JWT authentication on the client.
341 - To configure `client_authentication_methods`, the `create:client_credentials` scope is required.
342 - To configure `client_authentication_methods`, the property `jwt_configuration.alg` must be set to RS256.
343
344 SSO Integrations created via this endpoint will accept login requests and share user profile information.
345
346 Parameters
347 ----------
348 name : str
349 Name of this client (min length: 1 character, does not allow `<` or `>`).
350
351 description : typing.Optional[str]
352 Free text description of this client (max length: 140 characters).
353
354 logo_uri : typing.Optional[str]
355 URL of the logo to display for this client. Recommended size is 150x150 pixels.
356
357 callbacks : typing.Optional[typing.Sequence[str]]
358 Comma-separated list of URLs whitelisted for Auth0 to use as a callback to the client after authentication.
359
360 oidc_logout : typing.Optional[ClientOidcBackchannelLogoutSettings]
361
362 oidc_backchannel_logout : typing.Optional[ClientOidcBackchannelLogoutSettings]
363 Configuration for OIDC backchannel logout (deprecated, in favor of oidc_logout)
364
365 session_transfer : typing.Optional[ClientSessionTransferConfiguration]
366
367 allowed_origins : typing.Optional[typing.Sequence[str]]
368 Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level (e.g., https://*.contoso.com). Query strings and hash information are not taken into account when validating these URLs.
369
370 web_origins : typing.Optional[typing.Sequence[str]]
371 Comma-separated list of allowed origins for use with <a href='https://auth0.com/docs/cross-origin-authentication'>Cross-Origin Authentication</a>, <a href='https://auth0.com/docs/flows/concepts/device-auth'>Device Flow</a>, and <a href='https://auth0.com/docs/protocols/oauth2#how-response-mode-works'>web message response mode</a>.
372
373 client_aliases : typing.Optional[typing.Sequence[str]]
374 List of audiences/realms for SAML protocol. Used by the wsfed addon.
375
376 allowed_clients : typing.Optional[typing.Sequence[str]]
377 List of allow clients and API ids that are allowed to make delegation requests. Empty means all all your clients are allowed.
378
379 allowed_logout_urls : typing.Optional[typing.Sequence[str]]
380 Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains.
381
382 grant_types : typing.Optional[typing.Sequence[str]]
383 List of grant types supported for this application. 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`.
384
385 token_endpoint_auth_method : typing.Optional[ClientTokenEndpointAuthMethodEnum]
386
387 is_token_endpoint_ip_header_trusted : typing.Optional[bool]
388 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.
389
390 app_type : typing.Optional[ClientAppTypeEnum]
391
392 is_first_party : typing.Optional[bool]
393 Whether this client a first party client or not
394
395 oidc_conformant : typing.Optional[bool]
396 Whether this client conforms to <a href='https://auth0.com/docs/api-auth/tutorials/adoption'>strict OIDC specifications</a> (true) or uses legacy features (false).
397
398 jwt_configuration : typing.Optional[ClientJwtConfiguration]
399
400 encryption_key : typing.Optional[ClientEncryptionKey]
401
402 sso : typing.Optional[bool]
403 Applies only to SSO clients and determines whether Auth0 will handle Single Sign On (true) or whether the Identity Provider will (false).
404
405 cross_origin_authentication : typing.Optional[bool]
406 Whether this client can be used to make cross-origin authentication requests (true) or it is not allowed to make such requests (false).
407
408 cross_origin_loc : typing.Optional[str]
409 URL of 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.
410
411 sso_disabled : typing.Optional[bool]
412 <code>true</code> to disable Single Sign On, <code>false</code> otherwise (default: <code>false</code>)
413
414 custom_login_page_on : typing.Optional[bool]
415 <code>true</code> if the custom login page is to be used, <code>false</code> otherwise. Defaults to <code>true</code>
416
417 custom_login_page : typing.Optional[str]
418 The content (HTML, CSS, JS) of the custom login page.
419
420 custom_login_page_preview : typing.Optional[str]
421 The content (HTML, CSS, JS) of the custom login page. (Used on Previews)
422
423 form_template : typing.Optional[str]
424 HTML form template to be used for WS-Federation.
425
426 addons : typing.Optional[ClientAddons]
427
428 client_metadata : typing.Optional[ClientMetadata]
429
430 mobile : typing.Optional[ClientMobile]
431
432 initiate_login_uri : typing.Optional[str]
433 Initiate login uri, must be https
434
435 native_social_login : typing.Optional[NativeSocialLogin]
436
437 fedcm_login : typing.Optional[FedCmLogin]
438
439 refresh_token : typing.Optional[ClientRefreshTokenConfiguration]
440
441 default_organization : typing.Optional[ClientDefaultOrganization]
442
443 organization_usage : typing.Optional[ClientOrganizationUsageEnum]
444
445 organization_require_behavior : typing.Optional[ClientOrganizationRequireBehaviorEnum]
446
447 organization_discovery_methods : typing.Optional[typing.Sequence[ClientOrganizationDiscoveryEnum]]
448 Defines the available methods for organization discovery during the `pre_login_prompt`. Users can discover their organization either by `email`, `organization_name` or both.
449
450 client_authentication_methods : typing.Optional[ClientCreateAuthenticationMethod]
451
452 require_pushed_authorization_requests : typing.Optional[bool]
453 Makes the use of Pushed Authorization Requests mandatory for this client
454
455 require_proof_of_possession : typing.Optional[bool]
456 Makes the use of Proof-of-Possession mandatory for this client
457
458 signed_request_object : typing.Optional[ClientSignedRequestObjectWithPublicKey]
459
460 token_vault_privileged_access : typing.Optional[ClientTokenVaultPrivilegedAccessWithPublicKey]
461
462 compliance_level : typing.Optional[ClientComplianceLevelEnum]
463
464 skip_non_verifiable_callback_uri_confirmation_prompt : typing.Optional[bool]
465 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`).
466 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.
467 See https://auth0.com/docs/secure/security-guidance/measures-against-app-impersonation for more information.
468
469 token_exchange : typing.Optional[ClientTokenExchangeConfiguration]
470
471 par_request_expiry : typing.Optional[int]
472 Specifies how long, in seconds, a Pushed Authorization Request URI remains valid
473
474 token_quota : typing.Optional[CreateTokenQuota]
475
476 resource_server_identifier : typing.Optional[str]
477 The identifier of the resource server that this client is linked to.
478
479 identity_assertion_authorization_grant : typing.Optional[CreateIdentityAssertionAuthorizationGrant]
480
481 third_party_security_mode : typing.Optional[ClientThirdPartySecurityModeEnum]
482
483 redirection_policy : typing.Optional[ClientRedirectionPolicyEnum]
484
485 express_configuration : typing.Optional[ExpressConfiguration]
486
487 my_organization_configuration : typing.Optional[ClientMyOrganizationPostConfiguration]
488
489 async_approval_notification_channels : typing.Optional[ClientAsyncApprovalNotificationsChannelsApiPostConfiguration]
490
491 request_options : typing.Optional[RequestOptions]
492 Request-specific configuration.
493
494 Returns
495 -------
496 HttpResponse[CreateClientResponseContent]
497 Client successfully created.
498 """
499 _response = self._client_wrapper.httpx_client.request(
500 "clients",
501 method="POST",
502 json={
503 "name": name,
504 "description": description,
505 "logo_uri": logo_uri,
506 "callbacks": callbacks,
507 "oidc_logout": convert_and_respect_annotation_metadata(
508 object_=oidc_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
509 ),
510 "oidc_backchannel_logout": convert_and_respect_annotation_metadata(
511 object_=oidc_backchannel_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
512 ),
513 "session_transfer": convert_and_respect_annotation_metadata(
514 object_=session_transfer,
515 annotation=typing.Optional[ClientSessionTransferConfiguration],
516 direction="write",
517 ),
518 "allowed_origins": allowed_origins,
519 "web_origins": web_origins,
520 "client_aliases": client_aliases,
521 "allowed_clients": allowed_clients,
522 "allowed_logout_urls": allowed_logout_urls,
523 "grant_types": grant_types,
524 "token_endpoint_auth_method": token_endpoint_auth_method,
525 "is_token_endpoint_ip_header_trusted": is_token_endpoint_ip_header_trusted,
526 "app_type": app_type,
527 "is_first_party": is_first_party,
528 "oidc_conformant": oidc_conformant,
529 "jwt_configuration": convert_and_respect_annotation_metadata(
530 object_=jwt_configuration, annotation=ClientJwtConfiguration, direction="write"
531 ),
532 "encryption_key": convert_and_respect_annotation_metadata(
533 object_=encryption_key, annotation=typing.Optional[ClientEncryptionKey], direction="write"
534 ),
535 "sso": sso,
536 "cross_origin_authentication": cross_origin_authentication,
537 "cross_origin_loc": cross_origin_loc,
538 "sso_disabled": sso_disabled,
539 "custom_login_page_on": custom_login_page_on,
540 "custom_login_page": custom_login_page,
541 "custom_login_page_preview": custom_login_page_preview,
542 "form_template": form_template,
543 "addons": convert_and_respect_annotation_metadata(
544 object_=addons, annotation=ClientAddons, direction="write"
545 ),
546 "client_metadata": client_metadata,
547 "mobile": convert_and_respect_annotation_metadata(
548 object_=mobile, annotation=ClientMobile, direction="write"
549 ),
550 "initiate_login_uri": initiate_login_uri,
551 "native_social_login": convert_and_respect_annotation_metadata(
552 object_=native_social_login, annotation=NativeSocialLogin, direction="write"
553 ),
554 "fedcm_login": convert_and_respect_annotation_metadata(
555 object_=fedcm_login, annotation=FedCmLogin, direction="write"
556 ),
557 "refresh_token": convert_and_respect_annotation_metadata(
558 object_=refresh_token,
559 annotation=typing.Optional[ClientRefreshTokenConfiguration],
560 direction="write",
561 ),
562 "default_organization": convert_and_respect_annotation_metadata(
563 object_=default_organization,
564 annotation=typing.Optional[ClientDefaultOrganization],
565 direction="write",
566 ),
567 "organization_usage": organization_usage,
568 "organization_require_behavior": organization_require_behavior,
569 "organization_discovery_methods": organization_discovery_methods,
570 "client_authentication_methods": convert_and_respect_annotation_metadata(
571 object_=client_authentication_methods,
572 annotation=ClientCreateAuthenticationMethod,
573 direction="write",
574 ),
575 "require_pushed_authorization_requests": require_pushed_authorization_requests,
576 "require_proof_of_possession": require_proof_of_possession,
577 "signed_request_object": convert_and_respect_annotation_metadata(
578 object_=signed_request_object, annotation=ClientSignedRequestObjectWithPublicKey, direction="write"
579 ),
580 "token_vault_privileged_access": convert_and_respect_annotation_metadata(
581 object_=token_vault_privileged_access,
582 annotation=ClientTokenVaultPrivilegedAccessWithPublicKey,
583 direction="write",
584 ),
585 "compliance_level": compliance_level,
586 "skip_non_verifiable_callback_uri_confirmation_prompt": skip_non_verifiable_callback_uri_confirmation_prompt,
587 "token_exchange": convert_and_respect_annotation_metadata(
588 object_=token_exchange, annotation=ClientTokenExchangeConfiguration, direction="write"
589 ),
590 "par_request_expiry": par_request_expiry,
591 "token_quota": convert_and_respect_annotation_metadata(
592 object_=token_quota, annotation=CreateTokenQuota, direction="write"
593 ),
594 "resource_server_identifier": resource_server_identifier,
595 "identity_assertion_authorization_grant": convert_and_respect_annotation_metadata(
596 object_=identity_assertion_authorization_grant,
597 annotation=CreateIdentityAssertionAuthorizationGrant,
598 direction="write",
599 ),
600 "third_party_security_mode": third_party_security_mode,
601 "redirection_policy": redirection_policy,
602 "express_configuration": convert_and_respect_annotation_metadata(
603 object_=express_configuration, annotation=ExpressConfiguration, direction="write"
604 ),
605 "my_organization_configuration": convert_and_respect_annotation_metadata(
606 object_=my_organization_configuration,
607 annotation=ClientMyOrganizationPostConfiguration,
608 direction="write",
609 ),
610 "async_approval_notification_channels": async_approval_notification_channels,
611 },
612 headers={
613 "content-type": "application/json",
614 },
615 request_options=request_options,
616 omit=OMIT,
617 )
618 try:
619 if 200 <= _response.status_code < 300:
620 _data = typing.cast(
621 CreateClientResponseContent,
622 parse_obj_as(
623 type_=CreateClientResponseContent, # type: ignore
624 object_=_response.json(),
625 ),
626 )
627 return HttpResponse(response=_response, data=_data)
628 if _response.status_code == 400:
629 raise BadRequestError(
630 headers=dict(_response.headers),
631 body=typing.cast(
632 typing.Any,
633 parse_obj_as(
634 type_=typing.Any, # type: ignore
635 object_=_response.json(),
636 ),
637 ),
638 )
639 if _response.status_code == 401:
640 raise UnauthorizedError(
641 headers=dict(_response.headers),
642 body=typing.cast(
643 typing.Any,
644 parse_obj_as(
645 type_=typing.Any, # type: ignore
646 object_=_response.json(),
647 ),
648 ),
649 )
650 if _response.status_code == 403:
651 raise ForbiddenError(
652 headers=dict(_response.headers),
653 body=typing.cast(
654 typing.Any,
655 parse_obj_as(
656 type_=typing.Any, # type: ignore
657 object_=_response.json(),
658 ),
659 ),
660 )
661 if _response.status_code == 404:
662 raise NotFoundError(
663 headers=dict(_response.headers),
664 body=typing.cast(
665 typing.Any,
666 parse_obj_as(
667 type_=typing.Any, # type: ignore
668 object_=_response.json(),
669 ),
670 ),
671 )
672 if _response.status_code == 409:
673 raise ConflictError(
674 headers=dict(_response.headers),
675 body=typing.cast(
676 typing.Any,
677 parse_obj_as(
678 type_=typing.Any, # type: ignore
679 object_=_response.json(),
680 ),
681 ),
682 )
683 if _response.status_code == 429:
684 raise TooManyRequestsError(
685 headers=dict(_response.headers),
686 body=typing.cast(
687 typing.Any,
688 parse_obj_as(
689 type_=typing.Any, # type: ignore
690 object_=_response.json(),
691 ),
692 ),
693 )
694 _response_json = _response.json()
695 except JSONDecodeError:
696 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
697 except ValidationError as e:
698 raise ParsingError(
699 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
700 )
701 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
702
703 def preview_cimd_metadata(
704 self, *, external_client_id: str, request_options: typing.Optional[RequestOptions] = None
705 ) -> HttpResponse[PreviewCimdMetadataResponseContent]:
706 """
707
708 Fetches and validates a Client ID Metadata Document without creating a client.
709 Returns the raw metadata and how it would be mapped to Auth0 client fields.
710 This endpoint is useful for testing metadata URIs before creating CIMD clients.
711
712
713 Parameters
714 ----------
715 external_client_id : str
716 URL to the Client ID Metadata Document
717
718 request_options : typing.Optional[RequestOptions]
719 Request-specific configuration.
720
721 Returns
722 -------
723 HttpResponse[PreviewCimdMetadataResponseContent]
724 Metadata successfully fetched and validated, or retrieval error returned with errors array.
725 """
726 _response = self._client_wrapper.httpx_client.request(
727 "clients/cimd/preview",
728 method="POST",
729 json={
730 "external_client_id": external_client_id,
731 },
732 headers={
733 "content-type": "application/json",
734 },
735 request_options=request_options,
736 omit=OMIT,
737 )
738 try:
739 if 200 <= _response.status_code < 300:
740 _data = typing.cast(
741 PreviewCimdMetadataResponseContent,
742 parse_obj_as(
743 type_=PreviewCimdMetadataResponseContent, # type: ignore
744 object_=_response.json(),
745 ),
746 )
747 return HttpResponse(response=_response, data=_data)
748 if _response.status_code == 400:
749 raise BadRequestError(
750 headers=dict(_response.headers),
751 body=typing.cast(
752 typing.Any,
753 parse_obj_as(
754 type_=typing.Any, # type: ignore
755 object_=_response.json(),
756 ),
757 ),
758 )
759 if _response.status_code == 401:
760 raise UnauthorizedError(
761 headers=dict(_response.headers),
762 body=typing.cast(
763 typing.Any,
764 parse_obj_as(
765 type_=typing.Any, # type: ignore
766 object_=_response.json(),
767 ),
768 ),
769 )
770 if _response.status_code == 403:
771 raise ForbiddenError(
772 headers=dict(_response.headers),
773 body=typing.cast(
774 typing.Any,
775 parse_obj_as(
776 type_=typing.Any, # type: ignore
777 object_=_response.json(),
778 ),
779 ),
780 )
781 if _response.status_code == 429:
782 raise TooManyRequestsError(
783 headers=dict(_response.headers),
784 body=typing.cast(
785 typing.Any,
786 parse_obj_as(
787 type_=typing.Any, # type: ignore
788 object_=_response.json(),
789 ),
790 ),
791 )
792 if _response.status_code == 500:
793 raise InternalServerError(
794 headers=dict(_response.headers),
795 body=typing.cast(
796 typing.Any,
797 parse_obj_as(
798 type_=typing.Any, # type: ignore
799 object_=_response.json(),
800 ),
801 ),
802 )
803 _response_json = _response.json()
804 except JSONDecodeError:
805 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
806 except ValidationError as e:
807 raise ParsingError(
808 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
809 )
810 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
811
812 def register_cimd_client(
813 self, *, external_client_id: str, request_options: typing.Optional[RequestOptions] = None
814 ) -> HttpResponse[RegisterCimdClientResponseContent]:
815 """
816 Idempotent registration for Client ID Metadata Document (CIMD) clients.
817 Uses external_client_id as the unique identifier for upsert operations.
818
819 **Create:** Returns 201 when a new client is created (requires `create:clients` scope).
820 **Update:** Returns 200 when an existing client is updated (requires `update:clients` scope).
821
822 This endpoint automatically:
823 - Fetches and validates the metadata document
824 - Maps CIMD fields to Auth0 client configuration
825 - Creates/rotates credentials from the JWKS
826 - Enforces CIMD security policies (HTTPS-only, no shared secrets)
827
828 Parameters
829 ----------
830 external_client_id : str
831 URL to the Client ID Metadata Document. Acts as the unique identifier for upsert operations.
832
833 request_options : typing.Optional[RequestOptions]
834 Request-specific configuration.
835
836 Returns
837 -------
838 HttpResponse[RegisterCimdClientResponseContent]
839 CIMD client successfully updated (idempotent).
840 """
841 _response = self._client_wrapper.httpx_client.request(
842 "clients/cimd/register",
843 method="POST",
844 json={
845 "external_client_id": external_client_id,
846 },
847 headers={
848 "content-type": "application/json",
849 },
850 request_options=request_options,
851 omit=OMIT,
852 )
853 try:
854 if 200 <= _response.status_code < 300:
855 _data = typing.cast(
856 RegisterCimdClientResponseContent,
857 parse_obj_as(
858 type_=RegisterCimdClientResponseContent, # type: ignore
859 object_=_response.json(),
860 ),
861 )
862 return HttpResponse(response=_response, data=_data)
863 if _response.status_code == 400:
864 raise BadRequestError(
865 headers=dict(_response.headers),
866 body=typing.cast(
867 typing.Any,
868 parse_obj_as(
869 type_=typing.Any, # type: ignore
870 object_=_response.json(),
871 ),
872 ),
873 )
874 if _response.status_code == 401:
875 raise UnauthorizedError(
876 headers=dict(_response.headers),
877 body=typing.cast(
878 typing.Any,
879 parse_obj_as(
880 type_=typing.Any, # type: ignore
881 object_=_response.json(),
882 ),
883 ),
884 )
885 if _response.status_code == 403:
886 raise ForbiddenError(
887 headers=dict(_response.headers),
888 body=typing.cast(
889 typing.Any,
890 parse_obj_as(
891 type_=typing.Any, # type: ignore
892 object_=_response.json(),
893 ),
894 ),
895 )
896 if _response.status_code == 429:
897 raise TooManyRequestsError(
898 headers=dict(_response.headers),
899 body=typing.cast(
900 typing.Any,
901 parse_obj_as(
902 type_=typing.Any, # type: ignore
903 object_=_response.json(),
904 ),
905 ),
906 )
907 if _response.status_code == 500:
908 raise InternalServerError(
909 headers=dict(_response.headers),
910 body=typing.cast(
911 typing.Any,
912 parse_obj_as(
913 type_=typing.Any, # type: ignore
914 object_=_response.json(),
915 ),
916 ),
917 )
918 _response_json = _response.json()
919 except JSONDecodeError:
920 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
921 except ValidationError as e:
922 raise ParsingError(
923 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
924 )
925 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
926
927 def get(
928 self,
929 id: str,
930 *,
931 fields: typing.Optional[str] = None,
932 include_fields: typing.Optional[bool] = None,
933 request_options: typing.Optional[RequestOptions] = None,
934 ) -> HttpResponse[GetClientResponseContent]:
935 """
936 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.
937 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).
938
939 - The following properties can be retrieved with any of the scopes:
940 `client_id`, `app_type`, `name`, and `description`.
941 - The following properties can only be retrieved with the `read:clients` or
942 `read:client_keys` scopes:
943 `callbacks`, `oidc_logout`, `allowed_origins`,
944 `web_origins`, `tenant`, `global`, `config_route`,
945 `callback_url_template`, `jwt_configuration`,
946 `jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`,
947 `jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`,
948 `logo_uri`, `allowed_clients`, `owners`, `custom_login_page`,
949 `custom_login_page_off`, `sso`, `addons`, `form_template`,
950 `custom_login_page_codeview`, `resource_servers`, `client_metadata`,
951 `mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`,
952 `token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`,
953 `is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`,
954 `refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`,
955 `refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`,
956 `organization_require_behavior`.
957 - The following properties can only be retrieved with the `read:client_keys` or `read:client_credentials` scopes:
958 `encryption_key`, `encryption_key.pub`, `encryption_key.cert`,
959 `client_secret`, `client_authentication_methods` and `signing_key`.
960
961 Parameters
962 ----------
963 id : str
964 ID of the client to retrieve.
965
966 fields : typing.Optional[str]
967 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.
968
969 include_fields : typing.Optional[bool]
970 Whether specified fields are to be included (true) or excluded (false).
971
972 request_options : typing.Optional[RequestOptions]
973 Request-specific configuration.
974
975 Returns
976 -------
977 HttpResponse[GetClientResponseContent]
978 Client successfully retrieved.
979 """
980 _response = self._client_wrapper.httpx_client.request(
981 f"clients/{encode_path_param(id)}",
982 method="GET",
983 params={
984 "fields": fields,
985 "include_fields": include_fields,
986 },
987 request_options=request_options,
988 )
989 try:
990 if 200 <= _response.status_code < 300:
991 _data = typing.cast(
992 GetClientResponseContent,
993 parse_obj_as(
994 type_=GetClientResponseContent, # type: ignore
995 object_=_response.json(),
996 ),
997 )
998 return HttpResponse(response=_response, data=_data)
999 if _response.status_code == 400:
1000 raise BadRequestError(
1001 headers=dict(_response.headers),
1002 body=typing.cast(
1003 typing.Any,
1004 parse_obj_as(
1005 type_=typing.Any, # type: ignore
1006 object_=_response.json(),
1007 ),
1008 ),
1009 )
1010 if _response.status_code == 401:
1011 raise UnauthorizedError(
1012 headers=dict(_response.headers),
1013 body=typing.cast(
1014 typing.Any,
1015 parse_obj_as(
1016 type_=typing.Any, # type: ignore
1017 object_=_response.json(),
1018 ),
1019 ),
1020 )
1021 if _response.status_code == 403:
1022 raise ForbiddenError(
1023 headers=dict(_response.headers),
1024 body=typing.cast(
1025 typing.Any,
1026 parse_obj_as(
1027 type_=typing.Any, # type: ignore
1028 object_=_response.json(),
1029 ),
1030 ),
1031 )
1032 if _response.status_code == 404:
1033 raise NotFoundError(
1034 headers=dict(_response.headers),
1035 body=typing.cast(
1036 typing.Any,
1037 parse_obj_as(
1038 type_=typing.Any, # type: ignore
1039 object_=_response.json(),
1040 ),
1041 ),
1042 )
1043 if _response.status_code == 429:
1044 raise TooManyRequestsError(
1045 headers=dict(_response.headers),
1046 body=typing.cast(
1047 typing.Any,
1048 parse_obj_as(
1049 type_=typing.Any, # type: ignore
1050 object_=_response.json(),
1051 ),
1052 ),
1053 )
1054 _response_json = _response.json()
1055 except JSONDecodeError:
1056 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1057 except ValidationError as e:
1058 raise ParsingError(
1059 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1060 )
1061 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1062
1063 def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
1064 """
1065 Delete a client and related configuration (rules, connections, etc).
1066
1067 Parameters
1068 ----------
1069 id : str
1070 ID of the client to delete.
1071
1072 request_options : typing.Optional[RequestOptions]
1073 Request-specific configuration.
1074
1075 Returns
1076 -------
1077 HttpResponse[None]
1078 """
1079 _response = self._client_wrapper.httpx_client.request(
1080 f"clients/{encode_path_param(id)}",
1081 method="DELETE",
1082 request_options=request_options,
1083 )
1084 try:
1085 if 200 <= _response.status_code < 300:
1086 return HttpResponse(response=_response, data=None)
1087 if _response.status_code == 400:
1088 raise BadRequestError(
1089 headers=dict(_response.headers),
1090 body=typing.cast(
1091 typing.Any,
1092 parse_obj_as(
1093 type_=typing.Any, # type: ignore
1094 object_=_response.json(),
1095 ),
1096 ),
1097 )
1098 if _response.status_code == 401:
1099 raise UnauthorizedError(
1100 headers=dict(_response.headers),
1101 body=typing.cast(
1102 typing.Any,
1103 parse_obj_as(
1104 type_=typing.Any, # type: ignore
1105 object_=_response.json(),
1106 ),
1107 ),
1108 )
1109 if _response.status_code == 403:
1110 raise ForbiddenError(
1111 headers=dict(_response.headers),
1112 body=typing.cast(
1113 typing.Any,
1114 parse_obj_as(
1115 type_=typing.Any, # type: ignore
1116 object_=_response.json(),
1117 ),
1118 ),
1119 )
1120 if _response.status_code == 429:
1121 raise TooManyRequestsError(
1122 headers=dict(_response.headers),
1123 body=typing.cast(
1124 typing.Any,
1125 parse_obj_as(
1126 type_=typing.Any, # type: ignore
1127 object_=_response.json(),
1128 ),
1129 ),
1130 )
1131 _response_json = _response.json()
1132 except JSONDecodeError:
1133 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1134 except ValidationError as e:
1135 raise ParsingError(
1136 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1137 )
1138 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1139
1140 def update(
1141 self,
1142 id: str,
1143 *,
1144 name: typing.Optional[str] = OMIT,
1145 description: typing.Optional[str] = OMIT,
1146 client_secret: typing.Optional[str] = OMIT,
1147 logo_uri: typing.Optional[str] = OMIT,
1148 callbacks: typing.Optional[typing.Sequence[str]] = OMIT,
1149 oidc_logout: typing.Optional[ClientOidcBackchannelLogoutSettings] = OMIT,
1150 oidc_backchannel_logout: typing.Optional[ClientOidcBackchannelLogoutSettings] = OMIT,
1151 session_transfer: typing.Optional[ClientSessionTransferConfiguration] = OMIT,
1152 allowed_origins: typing.Optional[typing.Sequence[str]] = OMIT,
1153 web_origins: typing.Optional[typing.Sequence[str]] = OMIT,
1154 grant_types: typing.Optional[typing.Sequence[str]] = OMIT,
1155 client_aliases: typing.Optional[typing.Sequence[str]] = OMIT,
1156 allowed_clients: typing.Optional[typing.Sequence[str]] = OMIT,
1157 allowed_logout_urls: typing.Optional[typing.Sequence[str]] = OMIT,
1158 jwt_configuration: typing.Optional[ClientJwtConfiguration] = OMIT,
1159 encryption_key: typing.Optional[ClientEncryptionKey] = OMIT,
1160 sso: typing.Optional[bool] = OMIT,
1161 cross_origin_authentication: typing.Optional[bool] = OMIT,
1162 cross_origin_loc: typing.Optional[str] = OMIT,
1163 sso_disabled: typing.Optional[bool] = OMIT,
1164 custom_login_page_on: typing.Optional[bool] = OMIT,
1165 token_endpoint_auth_method: typing.Optional[ClientTokenEndpointAuthMethodOrNullEnum] = OMIT,
1166 is_token_endpoint_ip_header_trusted: typing.Optional[bool] = OMIT,
1167 app_type: typing.Optional[ClientAppTypeEnum] = OMIT,
1168 is_first_party: typing.Optional[bool] = OMIT,
1169 oidc_conformant: typing.Optional[bool] = OMIT,
1170 custom_login_page: typing.Optional[str] = OMIT,
1171 custom_login_page_preview: typing.Optional[str] = OMIT,
1172 token_quota: typing.Optional[UpdateTokenQuota] = OMIT,
1173 identity_assertion_authorization_grant: typing.Optional[UpdateIdentityAssertionAuthorizationGrant] = OMIT,
1174 form_template: typing.Optional[str] = OMIT,
1175 addons: typing.Optional[ClientAddons] = OMIT,
1176 client_metadata: typing.Optional[ClientMetadata] = OMIT,
1177 mobile: typing.Optional[ClientMobile] = OMIT,
1178 initiate_login_uri: typing.Optional[str] = OMIT,
1179 native_social_login: typing.Optional[NativeSocialLoginPatch] = OMIT,
1180 fedcm_login: typing.Optional[FedCmLoginPatch] = OMIT,
1181 refresh_token: typing.Optional[ClientRefreshTokenConfiguration] = OMIT,
1182 default_organization: typing.Optional[ClientDefaultOrganization] = OMIT,
1183 organization_usage: typing.Optional[ClientOrganizationUsagePatchEnum] = OMIT,
1184 organization_require_behavior: typing.Optional[ClientOrganizationRequireBehaviorPatchEnum] = OMIT,
1185 organization_discovery_methods: typing.Optional[typing.Sequence[ClientOrganizationDiscoveryEnum]] = OMIT,
1186 client_authentication_methods: typing.Optional[ClientAuthenticationMethod] = OMIT,
1187 require_pushed_authorization_requests: typing.Optional[bool] = OMIT,
1188 require_proof_of_possession: typing.Optional[bool] = OMIT,
1189 signed_request_object: typing.Optional[ClientSignedRequestObjectWithCredentialId] = OMIT,
1190 token_vault_privileged_access: typing.Optional[ClientTokenVaultPrivilegedAccessWithCredentialId] = OMIT,
1191 compliance_level: typing.Optional[ClientComplianceLevelEnum] = OMIT,
1192 skip_non_verifiable_callback_uri_confirmation_prompt: typing.Optional[bool] = OMIT,
1193 token_exchange: typing.Optional[ClientTokenExchangeConfigurationOrNull] = OMIT,
1194 par_request_expiry: typing.Optional[int] = OMIT,
1195 express_configuration: typing.Optional[ExpressConfigurationOrNull] = OMIT,
1196 my_organization_configuration: typing.Optional[ClientMyOrganizationPatchConfiguration] = OMIT,
1197 async_approval_notification_channels: typing.Optional[
1198 ClientAsyncApprovalNotificationsChannelsApiPatchConfiguration
1199 ] = OMIT,
1200 third_party_security_mode: typing.Optional[ClientThirdPartySecurityModeEnum] = OMIT,
1201 redirection_policy: typing.Optional[ClientRedirectionPolicyEnum] = OMIT,
1202 request_options: typing.Optional[RequestOptions] = None,
1203 ) -> HttpResponse[UpdateClientResponseContent]:
1204 """
1205 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).
1206
1207 Notes:
1208 - The `client_secret` and `signing_key` attributes can only be updated with the `update:client_keys` scope.
1209 - 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).
1210 - 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.
1211 - To configure `client_authentication_methods`, the `update:client_credentials` scope is required.
1212 - To configure `client_authentication_methods`, the property `jwt_configuration.alg` must be set to RS256.
1213 - To change a client's `is_first_party` property to `false`, the `organization_usage` and `organization_require_behavior` properties must be unset.
1214
1215 Parameters
1216 ----------
1217 id : str
1218 ID of the client to update.
1219
1220 name : typing.Optional[str]
1221 The name of the client. Must contain at least one character. Does not allow '<' or '>'.
1222
1223 description : typing.Optional[str]
1224 Free text description of the purpose of the Client. (Max character length: <code>140</code>)
1225
1226 client_secret : typing.Optional[str]
1227 The secret used to sign tokens for the client
1228
1229 logo_uri : typing.Optional[str]
1230 The URL of the client logo (recommended size: 150x150)
1231
1232 callbacks : typing.Optional[typing.Sequence[str]]
1233 A set of URLs that are valid to call back from Auth0 when authenticating users
1234
1235 oidc_logout : typing.Optional[ClientOidcBackchannelLogoutSettings]
1236
1237 oidc_backchannel_logout : typing.Optional[ClientOidcBackchannelLogoutSettings]
1238 Configuration for OIDC backchannel logout (deprecated, in favor of oidc_logout)
1239
1240 session_transfer : typing.Optional[ClientSessionTransferConfiguration]
1241
1242 allowed_origins : typing.Optional[typing.Sequence[str]]
1243 A set of URLs that represents valid origins for CORS
1244
1245 web_origins : typing.Optional[typing.Sequence[str]]
1246 A set of URLs that represents valid web origins for use with web message response mode
1247
1248 grant_types : typing.Optional[typing.Sequence[str]]
1249 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`.
1250
1251 client_aliases : typing.Optional[typing.Sequence[str]]
1252 List of audiences for SAML protocol
1253
1254 allowed_clients : typing.Optional[typing.Sequence[str]]
1255 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
1256
1257 allowed_logout_urls : typing.Optional[typing.Sequence[str]]
1258 URLs that are valid to redirect to after logout from Auth0
1259
1260 jwt_configuration : typing.Optional[ClientJwtConfiguration]
1261 An object that holds settings related to how JWTs are created
1262
1263 encryption_key : typing.Optional[ClientEncryptionKey]
1264 The client's encryption key
1265
1266 sso : typing.Optional[bool]
1267 <code>true</code> to use Auth0 instead of the IdP to do Single Sign On, <code>false</code> otherwise (default: <code>false</code>)
1268
1269 cross_origin_authentication : typing.Optional[bool]
1270 <code>true</code> if this client can be used to make cross-origin authentication requests, <code>false</code> otherwise if cross origin is disabled
1271
1272 cross_origin_loc : typing.Optional[str]
1273 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.
1274
1275 sso_disabled : typing.Optional[bool]
1276 <code>true</code> to disable Single Sign On, <code>false</code> otherwise (default: <code>false</code>)
1277
1278 custom_login_page_on : typing.Optional[bool]
1279 <code>true</code> if the custom login page is to be used, <code>false</code> otherwise.
1280
1281 token_endpoint_auth_method : typing.Optional[ClientTokenEndpointAuthMethodOrNullEnum]
1282
1283 is_token_endpoint_ip_header_trusted : typing.Optional[bool]
1284 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.
1285
1286 app_type : typing.Optional[ClientAppTypeEnum]
1287
1288 is_first_party : typing.Optional[bool]
1289 Whether this client a first party client or not
1290
1291 oidc_conformant : typing.Optional[bool]
1292 Whether this client will conform to strict OIDC specifications
1293
1294 custom_login_page : typing.Optional[str]
1295 The content (HTML, CSS, JS) of the custom login page
1296
1297 custom_login_page_preview : typing.Optional[str]
1298
1299 token_quota : typing.Optional[UpdateTokenQuota]
1300
1301 identity_assertion_authorization_grant : typing.Optional[UpdateIdentityAssertionAuthorizationGrant]
1302
1303 form_template : typing.Optional[str]
1304 Form template for WS-Federation protocol
1305
1306 addons : typing.Optional[ClientAddons]
1307
1308 client_metadata : typing.Optional[ClientMetadata]
1309
1310 mobile : typing.Optional[ClientMobile]
1311 Configuration related to native mobile apps
1312
1313 initiate_login_uri : typing.Optional[str]
1314 Initiate login uri, must be https
1315
1316 native_social_login : typing.Optional[NativeSocialLoginPatch]
1317
1318 fedcm_login : typing.Optional[FedCmLoginPatch]
1319
1320 refresh_token : typing.Optional[ClientRefreshTokenConfiguration]
1321
1322 default_organization : typing.Optional[ClientDefaultOrganization]
1323
1324 organization_usage : typing.Optional[ClientOrganizationUsagePatchEnum]
1325
1326 organization_require_behavior : typing.Optional[ClientOrganizationRequireBehaviorPatchEnum]
1327
1328 organization_discovery_methods : typing.Optional[typing.Sequence[ClientOrganizationDiscoveryEnum]]
1329 Defines the available methods for organization discovery during the `pre_login_prompt`. Users can discover their organization either by `email`, `organization_name` or both.
1330
1331 client_authentication_methods : typing.Optional[ClientAuthenticationMethod]
1332
1333 require_pushed_authorization_requests : typing.Optional[bool]
1334 Makes the use of Pushed Authorization Requests mandatory for this client
1335
1336 require_proof_of_possession : typing.Optional[bool]
1337 Makes the use of Proof-of-Possession mandatory for this client
1338
1339 signed_request_object : typing.Optional[ClientSignedRequestObjectWithCredentialId]
1340
1341 token_vault_privileged_access : typing.Optional[ClientTokenVaultPrivilegedAccessWithCredentialId]
1342
1343 compliance_level : typing.Optional[ClientComplianceLevelEnum]
1344
1345 skip_non_verifiable_callback_uri_confirmation_prompt : typing.Optional[bool]
1346 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`).
1347 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.
1348 See https://auth0.com/docs/secure/security-guidance/measures-against-app-impersonation for more information.
1349
1350 token_exchange : typing.Optional[ClientTokenExchangeConfigurationOrNull]
1351
1352 par_request_expiry : typing.Optional[int]
1353 Specifies how long, in seconds, a Pushed Authorization Request URI remains valid
1354
1355 express_configuration : typing.Optional[ExpressConfigurationOrNull]
1356
1357 my_organization_configuration : typing.Optional[ClientMyOrganizationPatchConfiguration]
1358
1359 async_approval_notification_channels : typing.Optional[ClientAsyncApprovalNotificationsChannelsApiPatchConfiguration]
1360
1361 third_party_security_mode : typing.Optional[ClientThirdPartySecurityModeEnum]
1362
1363 redirection_policy : typing.Optional[ClientRedirectionPolicyEnum]
1364
1365 request_options : typing.Optional[RequestOptions]
1366 Request-specific configuration.
1367
1368 Returns
1369 -------
1370 HttpResponse[UpdateClientResponseContent]
1371 Client successfully updated.
1372 """
1373 _response = self._client_wrapper.httpx_client.request(
1374 f"clients/{encode_path_param(id)}",
1375 method="PATCH",
1376 json={
1377 "name": name,
1378 "description": description,
1379 "client_secret": client_secret,
1380 "logo_uri": logo_uri,
1381 "callbacks": callbacks,
1382 "oidc_logout": convert_and_respect_annotation_metadata(
1383 object_=oidc_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
1384 ),
1385 "oidc_backchannel_logout": convert_and_respect_annotation_metadata(
1386 object_=oidc_backchannel_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
1387 ),
1388 "session_transfer": convert_and_respect_annotation_metadata(
1389 object_=session_transfer,
1390 annotation=typing.Optional[ClientSessionTransferConfiguration],
1391 direction="write",
1392 ),
1393 "allowed_origins": allowed_origins,
1394 "web_origins": web_origins,
1395 "grant_types": grant_types,
1396 "client_aliases": client_aliases,
1397 "allowed_clients": allowed_clients,
1398 "allowed_logout_urls": allowed_logout_urls,
1399 "jwt_configuration": convert_and_respect_annotation_metadata(
1400 object_=jwt_configuration, annotation=ClientJwtConfiguration, direction="write"
1401 ),
1402 "encryption_key": convert_and_respect_annotation_metadata(
1403 object_=encryption_key, annotation=typing.Optional[ClientEncryptionKey], direction="write"
1404 ),
1405 "sso": sso,
1406 "cross_origin_authentication": cross_origin_authentication,
1407 "cross_origin_loc": cross_origin_loc,
1408 "sso_disabled": sso_disabled,
1409 "custom_login_page_on": custom_login_page_on,
1410 "token_endpoint_auth_method": token_endpoint_auth_method,
1411 "is_token_endpoint_ip_header_trusted": is_token_endpoint_ip_header_trusted,
1412 "app_type": app_type,
1413 "is_first_party": is_first_party,
1414 "oidc_conformant": oidc_conformant,
1415 "custom_login_page": custom_login_page,
1416 "custom_login_page_preview": custom_login_page_preview,
1417 "token_quota": convert_and_respect_annotation_metadata(
1418 object_=token_quota, annotation=typing.Optional[UpdateTokenQuota], direction="write"
1419 ),
1420 "identity_assertion_authorization_grant": convert_and_respect_annotation_metadata(
1421 object_=identity_assertion_authorization_grant,
1422 annotation=typing.Optional[UpdateIdentityAssertionAuthorizationGrant],
1423 direction="write",
1424 ),
1425 "form_template": form_template,
1426 "addons": convert_and_respect_annotation_metadata(
1427 object_=addons, annotation=ClientAddons, direction="write"
1428 ),
1429 "client_metadata": client_metadata,
1430 "mobile": convert_and_respect_annotation_metadata(
1431 object_=mobile, annotation=ClientMobile, direction="write"
1432 ),
1433 "initiate_login_uri": initiate_login_uri,
1434 "native_social_login": convert_and_respect_annotation_metadata(
1435 object_=native_social_login, annotation=typing.Optional[NativeSocialLoginPatch], direction="write"
1436 ),
1437 "fedcm_login": convert_and_respect_annotation_metadata(
1438 object_=fedcm_login, annotation=typing.Optional[FedCmLoginPatch], direction="write"
1439 ),
1440 "refresh_token": convert_and_respect_annotation_metadata(
1441 object_=refresh_token,
1442 annotation=typing.Optional[ClientRefreshTokenConfiguration],
1443 direction="write",
1444 ),
1445 "default_organization": convert_and_respect_annotation_metadata(
1446 object_=default_organization,
1447 annotation=typing.Optional[ClientDefaultOrganization],
1448 direction="write",
1449 ),
1450 "organization_usage": organization_usage,
1451 "organization_require_behavior": organization_require_behavior,
1452 "organization_discovery_methods": organization_discovery_methods,
1453 "client_authentication_methods": convert_and_respect_annotation_metadata(
1454 object_=client_authentication_methods,
1455 annotation=typing.Optional[ClientAuthenticationMethod],
1456 direction="write",
1457 ),
1458 "require_pushed_authorization_requests": require_pushed_authorization_requests,
1459 "require_proof_of_possession": require_proof_of_possession,
1460 "signed_request_object": convert_and_respect_annotation_metadata(
1461 object_=signed_request_object,
1462 annotation=ClientSignedRequestObjectWithCredentialId,
1463 direction="write",
1464 ),
1465 "token_vault_privileged_access": convert_and_respect_annotation_metadata(
1466 object_=token_vault_privileged_access,
1467 annotation=ClientTokenVaultPrivilegedAccessWithCredentialId,
1468 direction="write",
1469 ),
1470 "compliance_level": compliance_level,
1471 "skip_non_verifiable_callback_uri_confirmation_prompt": skip_non_verifiable_callback_uri_confirmation_prompt,
1472 "token_exchange": convert_and_respect_annotation_metadata(
1473 object_=token_exchange,
1474 annotation=typing.Optional[ClientTokenExchangeConfigurationOrNull],
1475 direction="write",
1476 ),
1477 "par_request_expiry": par_request_expiry,
1478 "express_configuration": convert_and_respect_annotation_metadata(
1479 object_=express_configuration,
1480 annotation=typing.Optional[ExpressConfigurationOrNull],
1481 direction="write",
1482 ),
1483 "my_organization_configuration": convert_and_respect_annotation_metadata(
1484 object_=my_organization_configuration,
1485 annotation=typing.Optional[ClientMyOrganizationPatchConfiguration],
1486 direction="write",
1487 ),
1488 "async_approval_notification_channels": async_approval_notification_channels,
1489 "third_party_security_mode": third_party_security_mode,
1490 "redirection_policy": redirection_policy,
1491 },
1492 headers={
1493 "content-type": "application/json",
1494 },
1495 request_options=request_options,
1496 omit=OMIT,
1497 )
1498 try:
1499 if 200 <= _response.status_code < 300:
1500 _data = typing.cast(
1501 UpdateClientResponseContent,
1502 parse_obj_as(
1503 type_=UpdateClientResponseContent, # type: ignore
1504 object_=_response.json(),
1505 ),
1506 )
1507 return HttpResponse(response=_response, data=_data)
1508 if _response.status_code == 400:
1509 raise BadRequestError(
1510 headers=dict(_response.headers),
1511 body=typing.cast(
1512 typing.Any,
1513 parse_obj_as(
1514 type_=typing.Any, # type: ignore
1515 object_=_response.json(),
1516 ),
1517 ),
1518 )
1519 if _response.status_code == 401:
1520 raise UnauthorizedError(
1521 headers=dict(_response.headers),
1522 body=typing.cast(
1523 typing.Any,
1524 parse_obj_as(
1525 type_=typing.Any, # type: ignore
1526 object_=_response.json(),
1527 ),
1528 ),
1529 )
1530 if _response.status_code == 403:
1531 raise ForbiddenError(
1532 headers=dict(_response.headers),
1533 body=typing.cast(
1534 typing.Any,
1535 parse_obj_as(
1536 type_=typing.Any, # type: ignore
1537 object_=_response.json(),
1538 ),
1539 ),
1540 )
1541 if _response.status_code == 404:
1542 raise NotFoundError(
1543 headers=dict(_response.headers),
1544 body=typing.cast(
1545 typing.Any,
1546 parse_obj_as(
1547 type_=typing.Any, # type: ignore
1548 object_=_response.json(),
1549 ),
1550 ),
1551 )
1552 if _response.status_code == 429:
1553 raise TooManyRequestsError(
1554 headers=dict(_response.headers),
1555 body=typing.cast(
1556 typing.Any,
1557 parse_obj_as(
1558 type_=typing.Any, # type: ignore
1559 object_=_response.json(),
1560 ),
1561 ),
1562 )
1563 _response_json = _response.json()
1564 except JSONDecodeError:
1565 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1566 except ValidationError as e:
1567 raise ParsingError(
1568 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1569 )
1570 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1571
1572 def rotate_secret(
1573 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1574 ) -> HttpResponse[RotateClientSecretResponseContent]:
1575 """
1576 Rotate a client secret.
1577
1578 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.
1579
1580 For more information, read [Rotate Client Secrets](https://www.auth0.com/docs/get-started/applications/rotate-client-secret).
1581
1582 Parameters
1583 ----------
1584 id : str
1585 ID of the client that will rotate secrets.
1586
1587 request_options : typing.Optional[RequestOptions]
1588 Request-specific configuration.
1589
1590 Returns
1591 -------
1592 HttpResponse[RotateClientSecretResponseContent]
1593 Secret successfully rotated.
1594 """
1595 _response = self._client_wrapper.httpx_client.request(
1596 f"clients/{encode_path_param(id)}/rotate-secret",
1597 method="POST",
1598 request_options=request_options,
1599 )
1600 try:
1601 if 200 <= _response.status_code < 300:
1602 _data = typing.cast(
1603 RotateClientSecretResponseContent,
1604 parse_obj_as(
1605 type_=RotateClientSecretResponseContent, # type: ignore
1606 object_=_response.json(),
1607 ),
1608 )
1609 return HttpResponse(response=_response, data=_data)
1610 if _response.status_code == 400:
1611 raise BadRequestError(
1612 headers=dict(_response.headers),
1613 body=typing.cast(
1614 typing.Any,
1615 parse_obj_as(
1616 type_=typing.Any, # type: ignore
1617 object_=_response.json(),
1618 ),
1619 ),
1620 )
1621 if _response.status_code == 401:
1622 raise UnauthorizedError(
1623 headers=dict(_response.headers),
1624 body=typing.cast(
1625 typing.Any,
1626 parse_obj_as(
1627 type_=typing.Any, # type: ignore
1628 object_=_response.json(),
1629 ),
1630 ),
1631 )
1632 if _response.status_code == 403:
1633 raise ForbiddenError(
1634 headers=dict(_response.headers),
1635 body=typing.cast(
1636 typing.Any,
1637 parse_obj_as(
1638 type_=typing.Any, # type: ignore
1639 object_=_response.json(),
1640 ),
1641 ),
1642 )
1643 if _response.status_code == 404:
1644 raise NotFoundError(
1645 headers=dict(_response.headers),
1646 body=typing.cast(
1647 typing.Any,
1648 parse_obj_as(
1649 type_=typing.Any, # type: ignore
1650 object_=_response.json(),
1651 ),
1652 ),
1653 )
1654 if _response.status_code == 429:
1655 raise TooManyRequestsError(
1656 headers=dict(_response.headers),
1657 body=typing.cast(
1658 typing.Any,
1659 parse_obj_as(
1660 type_=typing.Any, # type: ignore
1661 object_=_response.json(),
1662 ),
1663 ),
1664 )
1665 _response_json = _response.json()
1666 except JSONDecodeError:
1667 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1668 except ValidationError as e:
1669 raise ParsingError(
1670 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1671 )
1672 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1673
1674
1675 class AsyncRawClientsClient:
1676 def __init__(self, *, client_wrapper: AsyncClientWrapper):
1677 self._client_wrapper = client_wrapper
1678
1679 async def list(
1680 self,
1681 *,
1682 fields: typing.Optional[str] = None,
1683 include_fields: typing.Optional[bool] = None,
1684 page: typing.Optional[int] = 0,
1685 per_page: typing.Optional[int] = 50,
1686 include_totals: typing.Optional[bool] = True,
1687 is_global: typing.Optional[bool] = None,
1688 is_first_party: typing.Optional[bool] = None,
1689 app_type: typing.Optional[str] = None,
1690 external_client_id: typing.Optional[str] = None,
1691 q: typing.Optional[str] = None,
1692 request_options: typing.Optional[RequestOptions] = None,
1693 ) -> AsyncPager[Client, ListClientsOffsetPaginatedResponseContent]:
1694 """
1695 Retrieve clients (applications and SSO integrations) matching provided filters. A list of fields to include or exclude may also be specified.
1696 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).
1697
1698 - The following can be retrieved with any scope:
1699 `client_id`, `app_type`, `name`, and `description`.
1700 - The following properties can only be retrieved with the `read:clients` or
1701 `read:client_keys` scope:
1702 `callbacks`, `oidc_logout`, `allowed_origins`,
1703 `web_origins`, `tenant`, `global`, `config_route`,
1704 `callback_url_template`, `jwt_configuration`,
1705 `jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`,
1706 `jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`,
1707 `logo_uri`, `allowed_clients`, `owners`, `custom_login_page`,
1708 `custom_login_page_off`, `sso`, `addons`, `form_template`,
1709 `custom_login_page_codeview`, `resource_servers`, `client_metadata`,
1710 `mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`,
1711 `token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`,
1712 `is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`,
1713 `refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`,
1714 `refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`,
1715 `organization_require_behavior`.
1716 - The following properties can only be retrieved with the
1717 `read:client_keys` or `read:client_credentials` scope:
1718 `encryption_key`, `encryption_key.pub`, `encryption_key.cert`,
1719 `client_secret`, `client_authentication_methods` and `signing_key`.
1720
1721 Parameters
1722 ----------
1723 fields : typing.Optional[str]
1724 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.
1725
1726 include_fields : typing.Optional[bool]
1727 Whether specified fields are to be included (true) or excluded (false).
1728
1729 page : typing.Optional[int]
1730 Page index of the results to return. First page is 0.
1731
1732 per_page : typing.Optional[int]
1733 Number of results per page. Default value is 50, maximum value is 100
1734
1735 include_totals : typing.Optional[bool]
1736 Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).
1737
1738 is_global : typing.Optional[bool]
1739 Optional filter on the global client parameter.
1740
1741 is_first_party : typing.Optional[bool]
1742 Optional filter on whether or not a client is a first-party client.
1743
1744 app_type : typing.Optional[str]
1745 Optional filter by a comma-separated list of application types.
1746
1747 external_client_id : typing.Optional[str]
1748 Optional filter by the <a href="https://drafts.oauth.net/draft-ietf-oauth-client-id-metadata-document/draft-ietf-oauth-client-id-metadata-document.html">Client ID Metadata Document</a> URI for CIMD-registered clients.
1749
1750 q : typing.Optional[str]
1751 Advanced Query in <a href="https://lucene.apache.org/core/2_9_4/queryparsersyntax.html">Lucene</a> syntax.<br /><b>Permitted Queries</b>:<br /><ul><li><i>client_grant.organization_id:{organization_id}</i></li><li><i>client_grant.allow_any_organization:true</i></li></ul><b>Additional Restrictions</b>:<br /><ul><li>Cannot be used in combination with other filters</li><li>Requires use of the <i>from</i> and <i>take</i> paging parameters (checkpoint paginatinon)</li><li>Reduced rate limits apply. See <a href="https://auth0.com/docs/troubleshoot/customer-support/operational-policies/rate-limit-policy/rate-limit-configurations/enterprise-public">Rate Limit Configurations</a></li></ul><i><b>Note</b>: Recent updates may not be immediately reflected in query results</i>
1752
1753 request_options : typing.Optional[RequestOptions]
1754 Request-specific configuration.
1755
1756 Returns
1757 -------
1758 AsyncPager[Client, ListClientsOffsetPaginatedResponseContent]
1759 Clients successfully retrieved.
1760 """
1761 page = page if page is not None else 0
1762
1763 _response = await self._client_wrapper.httpx_client.request(
1764 "clients",
1765 method="GET",
1766 params={
1767 "fields": fields,
1768 "include_fields": include_fields,
1769 "page": page,
1770 "per_page": per_page,
1771 "include_totals": include_totals,
1772 "is_global": is_global,
1773 "is_first_party": is_first_party,
1774 "app_type": app_type,
1775 "external_client_id": external_client_id,
1776 "q": q,
1777 },
1778 request_options=request_options,
1779 )
1780 try:
1781 if 200 <= _response.status_code < 300:
1782 _parsed_response = typing.cast(
1783 ListClientsOffsetPaginatedResponseContent,
1784 parse_obj_as(
1785 type_=ListClientsOffsetPaginatedResponseContent, # type: ignore
1786 object_=_response.json(),
1787 ),
1788 )
1789 _items = _parsed_response.clients
1790 _has_next = len(_items or []) > 0
1791
1792 async def _get_next():
1793 return await self.list(
1794 fields=fields,
1795 include_fields=include_fields,
1796 page=page + 1,
1797 per_page=per_page,
1798 include_totals=include_totals,
1799 is_global=is_global,
1800 is_first_party=is_first_party,
1801 app_type=app_type,
1802 external_client_id=external_client_id,
1803 q=q,
1804 request_options=request_options,
1805 )
1806
1807 return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
1808 if _response.status_code == 400:
1809 raise BadRequestError(
1810 headers=dict(_response.headers),
1811 body=typing.cast(
1812 typing.Any,
1813 parse_obj_as(
1814 type_=typing.Any, # type: ignore
1815 object_=_response.json(),
1816 ),
1817 ),
1818 )
1819 if _response.status_code == 401:
1820 raise UnauthorizedError(
1821 headers=dict(_response.headers),
1822 body=typing.cast(
1823 typing.Any,
1824 parse_obj_as(
1825 type_=typing.Any, # type: ignore
1826 object_=_response.json(),
1827 ),
1828 ),
1829 )
1830 if _response.status_code == 403:
1831 raise ForbiddenError(
1832 headers=dict(_response.headers),
1833 body=typing.cast(
1834 typing.Any,
1835 parse_obj_as(
1836 type_=typing.Any, # type: ignore
1837 object_=_response.json(),
1838 ),
1839 ),
1840 )
1841 if _response.status_code == 429:
1842 raise TooManyRequestsError(
1843 headers=dict(_response.headers),
1844 body=typing.cast(
1845 typing.Any,
1846 parse_obj_as(
1847 type_=typing.Any, # type: ignore
1848 object_=_response.json(),
1849 ),
1850 ),
1851 )
1852 _response_json = _response.json()
1853 except JSONDecodeError:
1854 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1855 except ValidationError as e:
1856 raise ParsingError(
1857 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1858 )
1859 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1860
1861 async def create(
1862 self,
1863 *,
1864 name: str,
1865 description: typing.Optional[str] = OMIT,
1866 logo_uri: typing.Optional[str] = OMIT,
1867 callbacks: typing.Optional[typing.Sequence[str]] = OMIT,
1868 oidc_logout: typing.Optional[ClientOidcBackchannelLogoutSettings] = OMIT,
1869 oidc_backchannel_logout: typing.Optional[ClientOidcBackchannelLogoutSettings] = OMIT,
1870 session_transfer: typing.Optional[ClientSessionTransferConfiguration] = OMIT,
1871 allowed_origins: typing.Optional[typing.Sequence[str]] = OMIT,
1872 web_origins: typing.Optional[typing.Sequence[str]] = OMIT,
1873 client_aliases: typing.Optional[typing.Sequence[str]] = OMIT,
1874 allowed_clients: typing.Optional[typing.Sequence[str]] = OMIT,
1875 allowed_logout_urls: typing.Optional[typing.Sequence[str]] = OMIT,
1876 grant_types: typing.Optional[typing.Sequence[str]] = OMIT,
1877 token_endpoint_auth_method: typing.Optional[ClientTokenEndpointAuthMethodEnum] = OMIT,
1878 is_token_endpoint_ip_header_trusted: typing.Optional[bool] = OMIT,
1879 app_type: typing.Optional[ClientAppTypeEnum] = OMIT,
1880 is_first_party: typing.Optional[bool] = OMIT,
1881 oidc_conformant: typing.Optional[bool] = OMIT,
1882 jwt_configuration: typing.Optional[ClientJwtConfiguration] = OMIT,
1883 encryption_key: typing.Optional[ClientEncryptionKey] = OMIT,
1884 sso: typing.Optional[bool] = OMIT,
1885 cross_origin_authentication: typing.Optional[bool] = OMIT,
1886 cross_origin_loc: typing.Optional[str] = OMIT,
1887 sso_disabled: typing.Optional[bool] = OMIT,
1888 custom_login_page_on: typing.Optional[bool] = OMIT,
1889 custom_login_page: typing.Optional[str] = OMIT,
1890 custom_login_page_preview: typing.Optional[str] = OMIT,
1891 form_template: typing.Optional[str] = OMIT,
1892 addons: typing.Optional[ClientAddons] = OMIT,
1893 client_metadata: typing.Optional[ClientMetadata] = OMIT,
1894 mobile: typing.Optional[ClientMobile] = OMIT,
1895 initiate_login_uri: typing.Optional[str] = OMIT,
1896 native_social_login: typing.Optional[NativeSocialLogin] = OMIT,
1897 fedcm_login: typing.Optional[FedCmLogin] = OMIT,
1898 refresh_token: typing.Optional[ClientRefreshTokenConfiguration] = OMIT,
1899 default_organization: typing.Optional[ClientDefaultOrganization] = OMIT,
1900 organization_usage: typing.Optional[ClientOrganizationUsageEnum] = OMIT,
1901 organization_require_behavior: typing.Optional[ClientOrganizationRequireBehaviorEnum] = OMIT,
1902 organization_discovery_methods: typing.Optional[typing.Sequence[ClientOrganizationDiscoveryEnum]] = OMIT,
1903 client_authentication_methods: typing.Optional[ClientCreateAuthenticationMethod] = OMIT,
1904 require_pushed_authorization_requests: typing.Optional[bool] = OMIT,
1905 require_proof_of_possession: typing.Optional[bool] = OMIT,
1906 signed_request_object: typing.Optional[ClientSignedRequestObjectWithPublicKey] = OMIT,
1907 token_vault_privileged_access: typing.Optional[ClientTokenVaultPrivilegedAccessWithPublicKey] = OMIT,
1908 compliance_level: typing.Optional[ClientComplianceLevelEnum] = OMIT,
1909 skip_non_verifiable_callback_uri_confirmation_prompt: typing.Optional[bool] = OMIT,
1910 token_exchange: typing.Optional[ClientTokenExchangeConfiguration] = OMIT,
1911 par_request_expiry: typing.Optional[int] = OMIT,
1912 token_quota: typing.Optional[CreateTokenQuota] = OMIT,
1913 resource_server_identifier: typing.Optional[str] = OMIT,
1914 identity_assertion_authorization_grant: typing.Optional[CreateIdentityAssertionAuthorizationGrant] = OMIT,
1915 third_party_security_mode: typing.Optional[ClientThirdPartySecurityModeEnum] = OMIT,
1916 redirection_policy: typing.Optional[ClientRedirectionPolicyEnum] = OMIT,
1917 express_configuration: typing.Optional[ExpressConfiguration] = OMIT,
1918 my_organization_configuration: typing.Optional[ClientMyOrganizationPostConfiguration] = OMIT,
1919 async_approval_notification_channels: typing.Optional[
1920 ClientAsyncApprovalNotificationsChannelsApiPostConfiguration
1921 ] = OMIT,
1922 request_options: typing.Optional[RequestOptions] = None,
1923 ) -> AsyncHttpResponse[CreateClientResponseContent]:
1924 """
1925 Create a new client (application or SSO integration). For more information, read [Create Applications](https://www.auth0.com/docs/get-started/auth0-overview/create-applications)
1926 [API Endpoints for Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on/api-endpoints-for-single-sign-on).
1927
1928 Notes:
1929 - We recommend leaving the `client_secret` parameter unspecified to allow the generation of a safe secret.
1930 - The `client_authentication_methods` and `token_endpoint_auth_method` properties are mutually exclusive. Use
1931 `client_authentication_methods` to configure the client with Private Key JWT authentication method. Otherwise, use `token_endpoint_auth_method`
1932 to configure the client with client secret (basic or post) or with no authentication method (none).
1933 - When using `client_authentication_methods` to configure the client with Private Key JWT authentication method, specify fully defined credentials.
1934 These credentials will be automatically enabled for Private Key JWT authentication on the client.
1935 - To configure `client_authentication_methods`, the `create:client_credentials` scope is required.
1936 - To configure `client_authentication_methods`, the property `jwt_configuration.alg` must be set to RS256.
1937
1938 SSO Integrations created via this endpoint will accept login requests and share user profile information.
1939
1940 Parameters
1941 ----------
1942 name : str
1943 Name of this client (min length: 1 character, does not allow `<` or `>`).
1944
1945 description : typing.Optional[str]
1946 Free text description of this client (max length: 140 characters).
1947
1948 logo_uri : typing.Optional[str]
1949 URL of the logo to display for this client. Recommended size is 150x150 pixels.
1950
1951 callbacks : typing.Optional[typing.Sequence[str]]
1952 Comma-separated list of URLs whitelisted for Auth0 to use as a callback to the client after authentication.
1953
1954 oidc_logout : typing.Optional[ClientOidcBackchannelLogoutSettings]
1955
1956 oidc_backchannel_logout : typing.Optional[ClientOidcBackchannelLogoutSettings]
1957 Configuration for OIDC backchannel logout (deprecated, in favor of oidc_logout)
1958
1959 session_transfer : typing.Optional[ClientSessionTransferConfiguration]
1960
1961 allowed_origins : typing.Optional[typing.Sequence[str]]
1962 Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level (e.g., https://*.contoso.com). Query strings and hash information are not taken into account when validating these URLs.
1963
1964 web_origins : typing.Optional[typing.Sequence[str]]
1965 Comma-separated list of allowed origins for use with <a href='https://auth0.com/docs/cross-origin-authentication'>Cross-Origin Authentication</a>, <a href='https://auth0.com/docs/flows/concepts/device-auth'>Device Flow</a>, and <a href='https://auth0.com/docs/protocols/oauth2#how-response-mode-works'>web message response mode</a>.
1966
1967 client_aliases : typing.Optional[typing.Sequence[str]]
1968 List of audiences/realms for SAML protocol. Used by the wsfed addon.
1969
1970 allowed_clients : typing.Optional[typing.Sequence[str]]
1971 List of allow clients and API ids that are allowed to make delegation requests. Empty means all all your clients are allowed.
1972
1973 allowed_logout_urls : typing.Optional[typing.Sequence[str]]
1974 Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains.
1975
1976 grant_types : typing.Optional[typing.Sequence[str]]
1977 List of grant types supported for this application. 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`.
1978
1979 token_endpoint_auth_method : typing.Optional[ClientTokenEndpointAuthMethodEnum]
1980
1981 is_token_endpoint_ip_header_trusted : typing.Optional[bool]
1982 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.
1983
1984 app_type : typing.Optional[ClientAppTypeEnum]
1985
1986 is_first_party : typing.Optional[bool]
1987 Whether this client a first party client or not
1988
1989 oidc_conformant : typing.Optional[bool]
1990 Whether this client conforms to <a href='https://auth0.com/docs/api-auth/tutorials/adoption'>strict OIDC specifications</a> (true) or uses legacy features (false).
1991
1992 jwt_configuration : typing.Optional[ClientJwtConfiguration]
1993
1994 encryption_key : typing.Optional[ClientEncryptionKey]
1995
1996 sso : typing.Optional[bool]
1997 Applies only to SSO clients and determines whether Auth0 will handle Single Sign On (true) or whether the Identity Provider will (false).
1998
1999 cross_origin_authentication : typing.Optional[bool]
2000 Whether this client can be used to make cross-origin authentication requests (true) or it is not allowed to make such requests (false).
2001
2002 cross_origin_loc : typing.Optional[str]
2003 URL of 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.
2004
2005 sso_disabled : typing.Optional[bool]
2006 <code>true</code> to disable Single Sign On, <code>false</code> otherwise (default: <code>false</code>)
2007
2008 custom_login_page_on : typing.Optional[bool]
2009 <code>true</code> if the custom login page is to be used, <code>false</code> otherwise. Defaults to <code>true</code>
2010
2011 custom_login_page : typing.Optional[str]
2012 The content (HTML, CSS, JS) of the custom login page.
2013
2014 custom_login_page_preview : typing.Optional[str]
2015 The content (HTML, CSS, JS) of the custom login page. (Used on Previews)
2016
2017 form_template : typing.Optional[str]
2018 HTML form template to be used for WS-Federation.
2019
2020 addons : typing.Optional[ClientAddons]
2021
2022 client_metadata : typing.Optional[ClientMetadata]
2023
2024 mobile : typing.Optional[ClientMobile]
2025
2026 initiate_login_uri : typing.Optional[str]
2027 Initiate login uri, must be https
2028
2029 native_social_login : typing.Optional[NativeSocialLogin]
2030
2031 fedcm_login : typing.Optional[FedCmLogin]
2032
2033 refresh_token : typing.Optional[ClientRefreshTokenConfiguration]
2034
2035 default_organization : typing.Optional[ClientDefaultOrganization]
2036
2037 organization_usage : typing.Optional[ClientOrganizationUsageEnum]
2038
2039 organization_require_behavior : typing.Optional[ClientOrganizationRequireBehaviorEnum]
2040
2041 organization_discovery_methods : typing.Optional[typing.Sequence[ClientOrganizationDiscoveryEnum]]
2042 Defines the available methods for organization discovery during the `pre_login_prompt`. Users can discover their organization either by `email`, `organization_name` or both.
2043
2044 client_authentication_methods : typing.Optional[ClientCreateAuthenticationMethod]
2045
2046 require_pushed_authorization_requests : typing.Optional[bool]
2047 Makes the use of Pushed Authorization Requests mandatory for this client
2048
2049 require_proof_of_possession : typing.Optional[bool]
2050 Makes the use of Proof-of-Possession mandatory for this client
2051
2052 signed_request_object : typing.Optional[ClientSignedRequestObjectWithPublicKey]
2053
2054 token_vault_privileged_access : typing.Optional[ClientTokenVaultPrivilegedAccessWithPublicKey]
2055
2056 compliance_level : typing.Optional[ClientComplianceLevelEnum]
2057
2058 skip_non_verifiable_callback_uri_confirmation_prompt : typing.Optional[bool]
2059 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`).
2060 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.
2061 See https://auth0.com/docs/secure/security-guidance/measures-against-app-impersonation for more information.
2062
2063 token_exchange : typing.Optional[ClientTokenExchangeConfiguration]
2064
2065 par_request_expiry : typing.Optional[int]
2066 Specifies how long, in seconds, a Pushed Authorization Request URI remains valid
2067
2068 token_quota : typing.Optional[CreateTokenQuota]
2069
2070 resource_server_identifier : typing.Optional[str]
2071 The identifier of the resource server that this client is linked to.
2072
2073 identity_assertion_authorization_grant : typing.Optional[CreateIdentityAssertionAuthorizationGrant]
2074
2075 third_party_security_mode : typing.Optional[ClientThirdPartySecurityModeEnum]
2076
2077 redirection_policy : typing.Optional[ClientRedirectionPolicyEnum]
2078
2079 express_configuration : typing.Optional[ExpressConfiguration]
2080
2081 my_organization_configuration : typing.Optional[ClientMyOrganizationPostConfiguration]
2082
2083 async_approval_notification_channels : typing.Optional[ClientAsyncApprovalNotificationsChannelsApiPostConfiguration]
2084
2085 request_options : typing.Optional[RequestOptions]
2086 Request-specific configuration.
2087
2088 Returns
2089 -------
2090 AsyncHttpResponse[CreateClientResponseContent]
2091 Client successfully created.
2092 """
2093 _response = await self._client_wrapper.httpx_client.request(
2094 "clients",
2095 method="POST",
2096 json={
2097 "name": name,
2098 "description": description,
2099 "logo_uri": logo_uri,
2100 "callbacks": callbacks,
2101 "oidc_logout": convert_and_respect_annotation_metadata(
2102 object_=oidc_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
2103 ),
2104 "oidc_backchannel_logout": convert_and_respect_annotation_metadata(
2105 object_=oidc_backchannel_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
2106 ),
2107 "session_transfer": convert_and_respect_annotation_metadata(
2108 object_=session_transfer,
2109 annotation=typing.Optional[ClientSessionTransferConfiguration],
2110 direction="write",
2111 ),
2112 "allowed_origins": allowed_origins,
2113 "web_origins": web_origins,
2114 "client_aliases": client_aliases,
2115 "allowed_clients": allowed_clients,
2116 "allowed_logout_urls": allowed_logout_urls,
2117 "grant_types": grant_types,
2118 "token_endpoint_auth_method": token_endpoint_auth_method,
2119 "is_token_endpoint_ip_header_trusted": is_token_endpoint_ip_header_trusted,
2120 "app_type": app_type,
2121 "is_first_party": is_first_party,
2122 "oidc_conformant": oidc_conformant,
2123 "jwt_configuration": convert_and_respect_annotation_metadata(
2124 object_=jwt_configuration, annotation=ClientJwtConfiguration, direction="write"
2125 ),
2126 "encryption_key": convert_and_respect_annotation_metadata(
2127 object_=encryption_key, annotation=typing.Optional[ClientEncryptionKey], direction="write"
2128 ),
2129 "sso": sso,
2130 "cross_origin_authentication": cross_origin_authentication,
2131 "cross_origin_loc": cross_origin_loc,
2132 "sso_disabled": sso_disabled,
2133 "custom_login_page_on": custom_login_page_on,
2134 "custom_login_page": custom_login_page,
2135 "custom_login_page_preview": custom_login_page_preview,
2136 "form_template": form_template,
2137 "addons": convert_and_respect_annotation_metadata(
2138 object_=addons, annotation=ClientAddons, direction="write"
2139 ),
2140 "client_metadata": client_metadata,
2141 "mobile": convert_and_respect_annotation_metadata(
2142 object_=mobile, annotation=ClientMobile, direction="write"
2143 ),
2144 "initiate_login_uri": initiate_login_uri,
2145 "native_social_login": convert_and_respect_annotation_metadata(
2146 object_=native_social_login, annotation=NativeSocialLogin, direction="write"
2147 ),
2148 "fedcm_login": convert_and_respect_annotation_metadata(
2149 object_=fedcm_login, annotation=FedCmLogin, direction="write"
2150 ),
2151 "refresh_token": convert_and_respect_annotation_metadata(
2152 object_=refresh_token,
2153 annotation=typing.Optional[ClientRefreshTokenConfiguration],
2154 direction="write",
2155 ),
2156 "default_organization": convert_and_respect_annotation_metadata(
2157 object_=default_organization,
2158 annotation=typing.Optional[ClientDefaultOrganization],
2159 direction="write",
2160 ),
2161 "organization_usage": organization_usage,
2162 "organization_require_behavior": organization_require_behavior,
2163 "organization_discovery_methods": organization_discovery_methods,
2164 "client_authentication_methods": convert_and_respect_annotation_metadata(
2165 object_=client_authentication_methods,
2166 annotation=ClientCreateAuthenticationMethod,
2167 direction="write",
2168 ),
2169 "require_pushed_authorization_requests": require_pushed_authorization_requests,
2170 "require_proof_of_possession": require_proof_of_possession,
2171 "signed_request_object": convert_and_respect_annotation_metadata(
2172 object_=signed_request_object, annotation=ClientSignedRequestObjectWithPublicKey, direction="write"
2173 ),
2174 "token_vault_privileged_access": convert_and_respect_annotation_metadata(
2175 object_=token_vault_privileged_access,
2176 annotation=ClientTokenVaultPrivilegedAccessWithPublicKey,
2177 direction="write",
2178 ),
2179 "compliance_level": compliance_level,
2180 "skip_non_verifiable_callback_uri_confirmation_prompt": skip_non_verifiable_callback_uri_confirmation_prompt,
2181 "token_exchange": convert_and_respect_annotation_metadata(
2182 object_=token_exchange, annotation=ClientTokenExchangeConfiguration, direction="write"
2183 ),
2184 "par_request_expiry": par_request_expiry,
2185 "token_quota": convert_and_respect_annotation_metadata(
2186 object_=token_quota, annotation=CreateTokenQuota, direction="write"
2187 ),
2188 "resource_server_identifier": resource_server_identifier,
2189 "identity_assertion_authorization_grant": convert_and_respect_annotation_metadata(
2190 object_=identity_assertion_authorization_grant,
2191 annotation=CreateIdentityAssertionAuthorizationGrant,
2192 direction="write",
2193 ),
2194 "third_party_security_mode": third_party_security_mode,
2195 "redirection_policy": redirection_policy,
2196 "express_configuration": convert_and_respect_annotation_metadata(
2197 object_=express_configuration, annotation=ExpressConfiguration, direction="write"
2198 ),
2199 "my_organization_configuration": convert_and_respect_annotation_metadata(
2200 object_=my_organization_configuration,
2201 annotation=ClientMyOrganizationPostConfiguration,
2202 direction="write",
2203 ),
2204 "async_approval_notification_channels": async_approval_notification_channels,
2205 },
2206 headers={
2207 "content-type": "application/json",
2208 },
2209 request_options=request_options,
2210 omit=OMIT,
2211 )
2212 try:
2213 if 200 <= _response.status_code < 300:
2214 _data = typing.cast(
2215 CreateClientResponseContent,
2216 parse_obj_as(
2217 type_=CreateClientResponseContent, # type: ignore
2218 object_=_response.json(),
2219 ),
2220 )
2221 return AsyncHttpResponse(response=_response, data=_data)
2222 if _response.status_code == 400:
2223 raise BadRequestError(
2224 headers=dict(_response.headers),
2225 body=typing.cast(
2226 typing.Any,
2227 parse_obj_as(
2228 type_=typing.Any, # type: ignore
2229 object_=_response.json(),
2230 ),
2231 ),
2232 )
2233 if _response.status_code == 401:
2234 raise UnauthorizedError(
2235 headers=dict(_response.headers),
2236 body=typing.cast(
2237 typing.Any,
2238 parse_obj_as(
2239 type_=typing.Any, # type: ignore
2240 object_=_response.json(),
2241 ),
2242 ),
2243 )
2244 if _response.status_code == 403:
2245 raise ForbiddenError(
2246 headers=dict(_response.headers),
2247 body=typing.cast(
2248 typing.Any,
2249 parse_obj_as(
2250 type_=typing.Any, # type: ignore
2251 object_=_response.json(),
2252 ),
2253 ),
2254 )
2255 if _response.status_code == 404:
2256 raise NotFoundError(
2257 headers=dict(_response.headers),
2258 body=typing.cast(
2259 typing.Any,
2260 parse_obj_as(
2261 type_=typing.Any, # type: ignore
2262 object_=_response.json(),
2263 ),
2264 ),
2265 )
2266 if _response.status_code == 409:
2267 raise ConflictError(
2268 headers=dict(_response.headers),
2269 body=typing.cast(
2270 typing.Any,
2271 parse_obj_as(
2272 type_=typing.Any, # type: ignore
2273 object_=_response.json(),
2274 ),
2275 ),
2276 )
2277 if _response.status_code == 429:
2278 raise TooManyRequestsError(
2279 headers=dict(_response.headers),
2280 body=typing.cast(
2281 typing.Any,
2282 parse_obj_as(
2283 type_=typing.Any, # type: ignore
2284 object_=_response.json(),
2285 ),
2286 ),
2287 )
2288 _response_json = _response.json()
2289 except JSONDecodeError:
2290 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2291 except ValidationError as e:
2292 raise ParsingError(
2293 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2294 )
2295 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2296
2297 async def preview_cimd_metadata(
2298 self, *, external_client_id: str, request_options: typing.Optional[RequestOptions] = None
2299 ) -> AsyncHttpResponse[PreviewCimdMetadataResponseContent]:
2300 """
2301
2302 Fetches and validates a Client ID Metadata Document without creating a client.
2303 Returns the raw metadata and how it would be mapped to Auth0 client fields.
2304 This endpoint is useful for testing metadata URIs before creating CIMD clients.
2305
2306
2307 Parameters
2308 ----------
2309 external_client_id : str
2310 URL to the Client ID Metadata Document
2311
2312 request_options : typing.Optional[RequestOptions]
2313 Request-specific configuration.
2314
2315 Returns
2316 -------
2317 AsyncHttpResponse[PreviewCimdMetadataResponseContent]
2318 Metadata successfully fetched and validated, or retrieval error returned with errors array.
2319 """
2320 _response = await self._client_wrapper.httpx_client.request(
2321 "clients/cimd/preview",
2322 method="POST",
2323 json={
2324 "external_client_id": external_client_id,
2325 },
2326 headers={
2327 "content-type": "application/json",
2328 },
2329 request_options=request_options,
2330 omit=OMIT,
2331 )
2332 try:
2333 if 200 <= _response.status_code < 300:
2334 _data = typing.cast(
2335 PreviewCimdMetadataResponseContent,
2336 parse_obj_as(
2337 type_=PreviewCimdMetadataResponseContent, # type: ignore
2338 object_=_response.json(),
2339 ),
2340 )
2341 return AsyncHttpResponse(response=_response, data=_data)
2342 if _response.status_code == 400:
2343 raise BadRequestError(
2344 headers=dict(_response.headers),
2345 body=typing.cast(
2346 typing.Any,
2347 parse_obj_as(
2348 type_=typing.Any, # type: ignore
2349 object_=_response.json(),
2350 ),
2351 ),
2352 )
2353 if _response.status_code == 401:
2354 raise UnauthorizedError(
2355 headers=dict(_response.headers),
2356 body=typing.cast(
2357 typing.Any,
2358 parse_obj_as(
2359 type_=typing.Any, # type: ignore
2360 object_=_response.json(),
2361 ),
2362 ),
2363 )
2364 if _response.status_code == 403:
2365 raise ForbiddenError(
2366 headers=dict(_response.headers),
2367 body=typing.cast(
2368 typing.Any,
2369 parse_obj_as(
2370 type_=typing.Any, # type: ignore
2371 object_=_response.json(),
2372 ),
2373 ),
2374 )
2375 if _response.status_code == 429:
2376 raise TooManyRequestsError(
2377 headers=dict(_response.headers),
2378 body=typing.cast(
2379 typing.Any,
2380 parse_obj_as(
2381 type_=typing.Any, # type: ignore
2382 object_=_response.json(),
2383 ),
2384 ),
2385 )
2386 if _response.status_code == 500:
2387 raise InternalServerError(
2388 headers=dict(_response.headers),
2389 body=typing.cast(
2390 typing.Any,
2391 parse_obj_as(
2392 type_=typing.Any, # type: ignore
2393 object_=_response.json(),
2394 ),
2395 ),
2396 )
2397 _response_json = _response.json()
2398 except JSONDecodeError:
2399 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2400 except ValidationError as e:
2401 raise ParsingError(
2402 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2403 )
2404 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2405
2406 async def register_cimd_client(
2407 self, *, external_client_id: str, request_options: typing.Optional[RequestOptions] = None
2408 ) -> AsyncHttpResponse[RegisterCimdClientResponseContent]:
2409 """
2410 Idempotent registration for Client ID Metadata Document (CIMD) clients.
2411 Uses external_client_id as the unique identifier for upsert operations.
2412
2413 **Create:** Returns 201 when a new client is created (requires `create:clients` scope).
2414 **Update:** Returns 200 when an existing client is updated (requires `update:clients` scope).
2415
2416 This endpoint automatically:
2417 - Fetches and validates the metadata document
2418 - Maps CIMD fields to Auth0 client configuration
2419 - Creates/rotates credentials from the JWKS
2420 - Enforces CIMD security policies (HTTPS-only, no shared secrets)
2421
2422 Parameters
2423 ----------
2424 external_client_id : str
2425 URL to the Client ID Metadata Document. Acts as the unique identifier for upsert operations.
2426
2427 request_options : typing.Optional[RequestOptions]
2428 Request-specific configuration.
2429
2430 Returns
2431 -------
2432 AsyncHttpResponse[RegisterCimdClientResponseContent]
2433 CIMD client successfully updated (idempotent).
2434 """
2435 _response = await self._client_wrapper.httpx_client.request(
2436 "clients/cimd/register",
2437 method="POST",
2438 json={
2439 "external_client_id": external_client_id,
2440 },
2441 headers={
2442 "content-type": "application/json",
2443 },
2444 request_options=request_options,
2445 omit=OMIT,
2446 )
2447 try:
2448 if 200 <= _response.status_code < 300:
2449 _data = typing.cast(
2450 RegisterCimdClientResponseContent,
2451 parse_obj_as(
2452 type_=RegisterCimdClientResponseContent, # type: ignore
2453 object_=_response.json(),
2454 ),
2455 )
2456 return AsyncHttpResponse(response=_response, data=_data)
2457 if _response.status_code == 400:
2458 raise BadRequestError(
2459 headers=dict(_response.headers),
2460 body=typing.cast(
2461 typing.Any,
2462 parse_obj_as(
2463 type_=typing.Any, # type: ignore
2464 object_=_response.json(),
2465 ),
2466 ),
2467 )
2468 if _response.status_code == 401:
2469 raise UnauthorizedError(
2470 headers=dict(_response.headers),
2471 body=typing.cast(
2472 typing.Any,
2473 parse_obj_as(
2474 type_=typing.Any, # type: ignore
2475 object_=_response.json(),
2476 ),
2477 ),
2478 )
2479 if _response.status_code == 403:
2480 raise ForbiddenError(
2481 headers=dict(_response.headers),
2482 body=typing.cast(
2483 typing.Any,
2484 parse_obj_as(
2485 type_=typing.Any, # type: ignore
2486 object_=_response.json(),
2487 ),
2488 ),
2489 )
2490 if _response.status_code == 429:
2491 raise TooManyRequestsError(
2492 headers=dict(_response.headers),
2493 body=typing.cast(
2494 typing.Any,
2495 parse_obj_as(
2496 type_=typing.Any, # type: ignore
2497 object_=_response.json(),
2498 ),
2499 ),
2500 )
2501 if _response.status_code == 500:
2502 raise InternalServerError(
2503 headers=dict(_response.headers),
2504 body=typing.cast(
2505 typing.Any,
2506 parse_obj_as(
2507 type_=typing.Any, # type: ignore
2508 object_=_response.json(),
2509 ),
2510 ),
2511 )
2512 _response_json = _response.json()
2513 except JSONDecodeError:
2514 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2515 except ValidationError as e:
2516 raise ParsingError(
2517 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2518 )
2519 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2520
2521 async def get(
2522 self,
2523 id: str,
2524 *,
2525 fields: typing.Optional[str] = None,
2526 include_fields: typing.Optional[bool] = None,
2527 request_options: typing.Optional[RequestOptions] = None,
2528 ) -> AsyncHttpResponse[GetClientResponseContent]:
2529 """
2530 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.
2531 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).
2532
2533 - The following properties can be retrieved with any of the scopes:
2534 `client_id`, `app_type`, `name`, and `description`.
2535 - The following properties can only be retrieved with the `read:clients` or
2536 `read:client_keys` scopes:
2537 `callbacks`, `oidc_logout`, `allowed_origins`,
2538 `web_origins`, `tenant`, `global`, `config_route`,
2539 `callback_url_template`, `jwt_configuration`,
2540 `jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`,
2541 `jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`,
2542 `logo_uri`, `allowed_clients`, `owners`, `custom_login_page`,
2543 `custom_login_page_off`, `sso`, `addons`, `form_template`,
2544 `custom_login_page_codeview`, `resource_servers`, `client_metadata`,
2545 `mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`,
2546 `token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`,
2547 `is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`,
2548 `refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`,
2549 `refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`,
2550 `organization_require_behavior`.
2551 - The following properties can only be retrieved with the `read:client_keys` or `read:client_credentials` scopes:
2552 `encryption_key`, `encryption_key.pub`, `encryption_key.cert`,
2553 `client_secret`, `client_authentication_methods` and `signing_key`.
2554
2555 Parameters
2556 ----------
2557 id : str
2558 ID of the client to retrieve.
2559
2560 fields : typing.Optional[str]
2561 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.
2562
2563 include_fields : typing.Optional[bool]
2564 Whether specified fields are to be included (true) or excluded (false).
2565
2566 request_options : typing.Optional[RequestOptions]
2567 Request-specific configuration.
2568
2569 Returns
2570 -------
2571 AsyncHttpResponse[GetClientResponseContent]
2572 Client successfully retrieved.
2573 """
2574 _response = await self._client_wrapper.httpx_client.request(
2575 f"clients/{encode_path_param(id)}",
2576 method="GET",
2577 params={
2578 "fields": fields,
2579 "include_fields": include_fields,
2580 },
2581 request_options=request_options,
2582 )
2583 try:
2584 if 200 <= _response.status_code < 300:
2585 _data = typing.cast(
2586 GetClientResponseContent,
2587 parse_obj_as(
2588 type_=GetClientResponseContent, # type: ignore
2589 object_=_response.json(),
2590 ),
2591 )
2592 return AsyncHttpResponse(response=_response, data=_data)
2593 if _response.status_code == 400:
2594 raise BadRequestError(
2595 headers=dict(_response.headers),
2596 body=typing.cast(
2597 typing.Any,
2598 parse_obj_as(
2599 type_=typing.Any, # type: ignore
2600 object_=_response.json(),
2601 ),
2602 ),
2603 )
2604 if _response.status_code == 401:
2605 raise UnauthorizedError(
2606 headers=dict(_response.headers),
2607 body=typing.cast(
2608 typing.Any,
2609 parse_obj_as(
2610 type_=typing.Any, # type: ignore
2611 object_=_response.json(),
2612 ),
2613 ),
2614 )
2615 if _response.status_code == 403:
2616 raise ForbiddenError(
2617 headers=dict(_response.headers),
2618 body=typing.cast(
2619 typing.Any,
2620 parse_obj_as(
2621 type_=typing.Any, # type: ignore
2622 object_=_response.json(),
2623 ),
2624 ),
2625 )
2626 if _response.status_code == 404:
2627 raise NotFoundError(
2628 headers=dict(_response.headers),
2629 body=typing.cast(
2630 typing.Any,
2631 parse_obj_as(
2632 type_=typing.Any, # type: ignore
2633 object_=_response.json(),
2634 ),
2635 ),
2636 )
2637 if _response.status_code == 429:
2638 raise TooManyRequestsError(
2639 headers=dict(_response.headers),
2640 body=typing.cast(
2641 typing.Any,
2642 parse_obj_as(
2643 type_=typing.Any, # type: ignore
2644 object_=_response.json(),
2645 ),
2646 ),
2647 )
2648 _response_json = _response.json()
2649 except JSONDecodeError:
2650 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2651 except ValidationError as e:
2652 raise ParsingError(
2653 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2654 )
2655 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2656
2657 async def delete(
2658 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
2659 ) -> AsyncHttpResponse[None]:
2660 """
2661 Delete a client and related configuration (rules, connections, etc).
2662
2663 Parameters
2664 ----------
2665 id : str
2666 ID of the client to delete.
2667
2668 request_options : typing.Optional[RequestOptions]
2669 Request-specific configuration.
2670
2671 Returns
2672 -------
2673 AsyncHttpResponse[None]
2674 """
2675 _response = await self._client_wrapper.httpx_client.request(
2676 f"clients/{encode_path_param(id)}",
2677 method="DELETE",
2678 request_options=request_options,
2679 )
2680 try:
2681 if 200 <= _response.status_code < 300:
2682 return AsyncHttpResponse(response=_response, data=None)
2683 if _response.status_code == 400:
2684 raise BadRequestError(
2685 headers=dict(_response.headers),
2686 body=typing.cast(
2687 typing.Any,
2688 parse_obj_as(
2689 type_=typing.Any, # type: ignore
2690 object_=_response.json(),
2691 ),
2692 ),
2693 )
2694 if _response.status_code == 401:
2695 raise UnauthorizedError(
2696 headers=dict(_response.headers),
2697 body=typing.cast(
2698 typing.Any,
2699 parse_obj_as(
2700 type_=typing.Any, # type: ignore
2701 object_=_response.json(),
2702 ),
2703 ),
2704 )
2705 if _response.status_code == 403:
2706 raise ForbiddenError(
2707 headers=dict(_response.headers),
2708 body=typing.cast(
2709 typing.Any,
2710 parse_obj_as(
2711 type_=typing.Any, # type: ignore
2712 object_=_response.json(),
2713 ),
2714 ),
2715 )
2716 if _response.status_code == 429:
2717 raise TooManyRequestsError(
2718 headers=dict(_response.headers),
2719 body=typing.cast(
2720 typing.Any,
2721 parse_obj_as(
2722 type_=typing.Any, # type: ignore
2723 object_=_response.json(),
2724 ),
2725 ),
2726 )
2727 _response_json = _response.json()
2728 except JSONDecodeError:
2729 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2730 except ValidationError as e:
2731 raise ParsingError(
2732 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2733 )
2734 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2735
2736 async def update(
2737 self,
2738 id: str,
2739 *,
2740 name: typing.Optional[str] = OMIT,
2741 description: typing.Optional[str] = OMIT,
2742 client_secret: typing.Optional[str] = OMIT,
2743 logo_uri: typing.Optional[str] = OMIT,
2744 callbacks: typing.Optional[typing.Sequence[str]] = OMIT,
2745 oidc_logout: typing.Optional[ClientOidcBackchannelLogoutSettings] = OMIT,
2746 oidc_backchannel_logout: typing.Optional[ClientOidcBackchannelLogoutSettings] = OMIT,
2747 session_transfer: typing.Optional[ClientSessionTransferConfiguration] = OMIT,
2748 allowed_origins: typing.Optional[typing.Sequence[str]] = OMIT,
2749 web_origins: typing.Optional[typing.Sequence[str]] = OMIT,
2750 grant_types: typing.Optional[typing.Sequence[str]] = OMIT,
2751 client_aliases: typing.Optional[typing.Sequence[str]] = OMIT,
2752 allowed_clients: typing.Optional[typing.Sequence[str]] = OMIT,
2753 allowed_logout_urls: typing.Optional[typing.Sequence[str]] = OMIT,
2754 jwt_configuration: typing.Optional[ClientJwtConfiguration] = OMIT,
2755 encryption_key: typing.Optional[ClientEncryptionKey] = OMIT,
2756 sso: typing.Optional[bool] = OMIT,
2757 cross_origin_authentication: typing.Optional[bool] = OMIT,
2758 cross_origin_loc: typing.Optional[str] = OMIT,
2759 sso_disabled: typing.Optional[bool] = OMIT,
2760 custom_login_page_on: typing.Optional[bool] = OMIT,
2761 token_endpoint_auth_method: typing.Optional[ClientTokenEndpointAuthMethodOrNullEnum] = OMIT,
2762 is_token_endpoint_ip_header_trusted: typing.Optional[bool] = OMIT,
2763 app_type: typing.Optional[ClientAppTypeEnum] = OMIT,
2764 is_first_party: typing.Optional[bool] = OMIT,
2765 oidc_conformant: typing.Optional[bool] = OMIT,
2766 custom_login_page: typing.Optional[str] = OMIT,
2767 custom_login_page_preview: typing.Optional[str] = OMIT,
2768 token_quota: typing.Optional[UpdateTokenQuota] = OMIT,
2769 identity_assertion_authorization_grant: typing.Optional[UpdateIdentityAssertionAuthorizationGrant] = OMIT,
2770 form_template: typing.Optional[str] = OMIT,
2771 addons: typing.Optional[ClientAddons] = OMIT,
2772 client_metadata: typing.Optional[ClientMetadata] = OMIT,
2773 mobile: typing.Optional[ClientMobile] = OMIT,
2774 initiate_login_uri: typing.Optional[str] = OMIT,
2775 native_social_login: typing.Optional[NativeSocialLoginPatch] = OMIT,
2776 fedcm_login: typing.Optional[FedCmLoginPatch] = OMIT,
2777 refresh_token: typing.Optional[ClientRefreshTokenConfiguration] = OMIT,
2778 default_organization: typing.Optional[ClientDefaultOrganization] = OMIT,
2779 organization_usage: typing.Optional[ClientOrganizationUsagePatchEnum] = OMIT,
2780 organization_require_behavior: typing.Optional[ClientOrganizationRequireBehaviorPatchEnum] = OMIT,
2781 organization_discovery_methods: typing.Optional[typing.Sequence[ClientOrganizationDiscoveryEnum]] = OMIT,
2782 client_authentication_methods: typing.Optional[ClientAuthenticationMethod] = OMIT,
2783 require_pushed_authorization_requests: typing.Optional[bool] = OMIT,
2784 require_proof_of_possession: typing.Optional[bool] = OMIT,
2785 signed_request_object: typing.Optional[ClientSignedRequestObjectWithCredentialId] = OMIT,
2786 token_vault_privileged_access: typing.Optional[ClientTokenVaultPrivilegedAccessWithCredentialId] = OMIT,
2787 compliance_level: typing.Optional[ClientComplianceLevelEnum] = OMIT,
2788 skip_non_verifiable_callback_uri_confirmation_prompt: typing.Optional[bool] = OMIT,
2789 token_exchange: typing.Optional[ClientTokenExchangeConfigurationOrNull] = OMIT,
2790 par_request_expiry: typing.Optional[int] = OMIT,
2791 express_configuration: typing.Optional[ExpressConfigurationOrNull] = OMIT,
2792 my_organization_configuration: typing.Optional[ClientMyOrganizationPatchConfiguration] = OMIT,
2793 async_approval_notification_channels: typing.Optional[
2794 ClientAsyncApprovalNotificationsChannelsApiPatchConfiguration
2795 ] = OMIT,
2796 third_party_security_mode: typing.Optional[ClientThirdPartySecurityModeEnum] = OMIT,
2797 redirection_policy: typing.Optional[ClientRedirectionPolicyEnum] = OMIT,
2798 request_options: typing.Optional[RequestOptions] = None,
2799 ) -> AsyncHttpResponse[UpdateClientResponseContent]:
2800 """
2801 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).
2802
2803 Notes:
2804 - The `client_secret` and `signing_key` attributes can only be updated with the `update:client_keys` scope.
2805 - 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).
2806 - 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.
2807 - To configure `client_authentication_methods`, the `update:client_credentials` scope is required.
2808 - To configure `client_authentication_methods`, the property `jwt_configuration.alg` must be set to RS256.
2809 - To change a client's `is_first_party` property to `false`, the `organization_usage` and `organization_require_behavior` properties must be unset.
2810
2811 Parameters
2812 ----------
2813 id : str
2814 ID of the client to update.
2815
2816 name : typing.Optional[str]
2817 The name of the client. Must contain at least one character. Does not allow '<' or '>'.
2818
2819 description : typing.Optional[str]
2820 Free text description of the purpose of the Client. (Max character length: <code>140</code>)
2821
2822 client_secret : typing.Optional[str]
2823 The secret used to sign tokens for the client
2824
2825 logo_uri : typing.Optional[str]
2826 The URL of the client logo (recommended size: 150x150)
2827
2828 callbacks : typing.Optional[typing.Sequence[str]]
2829 A set of URLs that are valid to call back from Auth0 when authenticating users
2830
2831 oidc_logout : typing.Optional[ClientOidcBackchannelLogoutSettings]
2832
2833 oidc_backchannel_logout : typing.Optional[ClientOidcBackchannelLogoutSettings]
2834 Configuration for OIDC backchannel logout (deprecated, in favor of oidc_logout)
2835
2836 session_transfer : typing.Optional[ClientSessionTransferConfiguration]
2837
2838 allowed_origins : typing.Optional[typing.Sequence[str]]
2839 A set of URLs that represents valid origins for CORS
2840
2841 web_origins : typing.Optional[typing.Sequence[str]]
2842 A set of URLs that represents valid web origins for use with web message response mode
2843
2844 grant_types : typing.Optional[typing.Sequence[str]]
2845 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`.
2846
2847 client_aliases : typing.Optional[typing.Sequence[str]]
2848 List of audiences for SAML protocol
2849
2850 allowed_clients : typing.Optional[typing.Sequence[str]]
2851 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
2852
2853 allowed_logout_urls : typing.Optional[typing.Sequence[str]]
2854 URLs that are valid to redirect to after logout from Auth0
2855
2856 jwt_configuration : typing.Optional[ClientJwtConfiguration]
2857 An object that holds settings related to how JWTs are created
2858
2859 encryption_key : typing.Optional[ClientEncryptionKey]
2860 The client's encryption key
2861
2862 sso : typing.Optional[bool]
2863 <code>true</code> to use Auth0 instead of the IdP to do Single Sign On, <code>false</code> otherwise (default: <code>false</code>)
2864
2865 cross_origin_authentication : typing.Optional[bool]
2866 <code>true</code> if this client can be used to make cross-origin authentication requests, <code>false</code> otherwise if cross origin is disabled
2867
2868 cross_origin_loc : typing.Optional[str]
2869 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.
2870
2871 sso_disabled : typing.Optional[bool]
2872 <code>true</code> to disable Single Sign On, <code>false</code> otherwise (default: <code>false</code>)
2873
2874 custom_login_page_on : typing.Optional[bool]
2875 <code>true</code> if the custom login page is to be used, <code>false</code> otherwise.
2876
2877 token_endpoint_auth_method : typing.Optional[ClientTokenEndpointAuthMethodOrNullEnum]
2878
2879 is_token_endpoint_ip_header_trusted : typing.Optional[bool]
2880 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.
2881
2882 app_type : typing.Optional[ClientAppTypeEnum]
2883
2884 is_first_party : typing.Optional[bool]
2885 Whether this client a first party client or not
2886
2887 oidc_conformant : typing.Optional[bool]
2888 Whether this client will conform to strict OIDC specifications
2889
2890 custom_login_page : typing.Optional[str]
2891 The content (HTML, CSS, JS) of the custom login page
2892
2893 custom_login_page_preview : typing.Optional[str]
2894
2895 token_quota : typing.Optional[UpdateTokenQuota]
2896
2897 identity_assertion_authorization_grant : typing.Optional[UpdateIdentityAssertionAuthorizationGrant]
2898
2899 form_template : typing.Optional[str]
2900 Form template for WS-Federation protocol
2901
2902 addons : typing.Optional[ClientAddons]
2903
2904 client_metadata : typing.Optional[ClientMetadata]
2905
2906 mobile : typing.Optional[ClientMobile]
2907 Configuration related to native mobile apps
2908
2909 initiate_login_uri : typing.Optional[str]
2910 Initiate login uri, must be https
2911
2912 native_social_login : typing.Optional[NativeSocialLoginPatch]
2913
2914 fedcm_login : typing.Optional[FedCmLoginPatch]
2915
2916 refresh_token : typing.Optional[ClientRefreshTokenConfiguration]
2917
2918 default_organization : typing.Optional[ClientDefaultOrganization]
2919
2920 organization_usage : typing.Optional[ClientOrganizationUsagePatchEnum]
2921
2922 organization_require_behavior : typing.Optional[ClientOrganizationRequireBehaviorPatchEnum]
2923
2924 organization_discovery_methods : typing.Optional[typing.Sequence[ClientOrganizationDiscoveryEnum]]
2925 Defines the available methods for organization discovery during the `pre_login_prompt`. Users can discover their organization either by `email`, `organization_name` or both.
2926
2927 client_authentication_methods : typing.Optional[ClientAuthenticationMethod]
2928
2929 require_pushed_authorization_requests : typing.Optional[bool]
2930 Makes the use of Pushed Authorization Requests mandatory for this client
2931
2932 require_proof_of_possession : typing.Optional[bool]
2933 Makes the use of Proof-of-Possession mandatory for this client
2934
2935 signed_request_object : typing.Optional[ClientSignedRequestObjectWithCredentialId]
2936
2937 token_vault_privileged_access : typing.Optional[ClientTokenVaultPrivilegedAccessWithCredentialId]
2938
2939 compliance_level : typing.Optional[ClientComplianceLevelEnum]
2940
2941 skip_non_verifiable_callback_uri_confirmation_prompt : typing.Optional[bool]
2942 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`).
2943 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.
2944 See https://auth0.com/docs/secure/security-guidance/measures-against-app-impersonation for more information.
2945
2946 token_exchange : typing.Optional[ClientTokenExchangeConfigurationOrNull]
2947
2948 par_request_expiry : typing.Optional[int]
2949 Specifies how long, in seconds, a Pushed Authorization Request URI remains valid
2950
2951 express_configuration : typing.Optional[ExpressConfigurationOrNull]
2952
2953 my_organization_configuration : typing.Optional[ClientMyOrganizationPatchConfiguration]
2954
2955 async_approval_notification_channels : typing.Optional[ClientAsyncApprovalNotificationsChannelsApiPatchConfiguration]
2956
2957 third_party_security_mode : typing.Optional[ClientThirdPartySecurityModeEnum]
2958
2959 redirection_policy : typing.Optional[ClientRedirectionPolicyEnum]
2960
2961 request_options : typing.Optional[RequestOptions]
2962 Request-specific configuration.
2963
2964 Returns
2965 -------
2966 AsyncHttpResponse[UpdateClientResponseContent]
2967 Client successfully updated.
2968 """
2969 _response = await self._client_wrapper.httpx_client.request(
2970 f"clients/{encode_path_param(id)}",
2971 method="PATCH",
2972 json={
2973 "name": name,
2974 "description": description,
2975 "client_secret": client_secret,
2976 "logo_uri": logo_uri,
2977 "callbacks": callbacks,
2978 "oidc_logout": convert_and_respect_annotation_metadata(
2979 object_=oidc_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
2980 ),
2981 "oidc_backchannel_logout": convert_and_respect_annotation_metadata(
2982 object_=oidc_backchannel_logout, annotation=ClientOidcBackchannelLogoutSettings, direction="write"
2983 ),
2984 "session_transfer": convert_and_respect_annotation_metadata(
2985 object_=session_transfer,
2986 annotation=typing.Optional[ClientSessionTransferConfiguration],
2987 direction="write",
2988 ),
2989 "allowed_origins": allowed_origins,
2990 "web_origins": web_origins,
2991 "grant_types": grant_types,
2992 "client_aliases": client_aliases,
2993 "allowed_clients": allowed_clients,
2994 "allowed_logout_urls": allowed_logout_urls,
2995 "jwt_configuration": convert_and_respect_annotation_metadata(
2996 object_=jwt_configuration, annotation=ClientJwtConfiguration, direction="write"
2997 ),
2998 "encryption_key": convert_and_respect_annotation_metadata(
2999 object_=encryption_key, annotation=typing.Optional[ClientEncryptionKey], direction="write"
3000 ),
3001 "sso": sso,
3002 "cross_origin_authentication": cross_origin_authentication,
3003 "cross_origin_loc": cross_origin_loc,
3004 "sso_disabled": sso_disabled,
3005 "custom_login_page_on": custom_login_page_on,
3006 "token_endpoint_auth_method": token_endpoint_auth_method,
3007 "is_token_endpoint_ip_header_trusted": is_token_endpoint_ip_header_trusted,
3008 "app_type": app_type,
3009 "is_first_party": is_first_party,
3010 "oidc_conformant": oidc_conformant,
3011 "custom_login_page": custom_login_page,
3012 "custom_login_page_preview": custom_login_page_preview,
3013 "token_quota": convert_and_respect_annotation_metadata(
3014 object_=token_quota, annotation=typing.Optional[UpdateTokenQuota], direction="write"
3015 ),
3016 "identity_assertion_authorization_grant": convert_and_respect_annotation_metadata(
3017 object_=identity_assertion_authorization_grant,
3018 annotation=typing.Optional[UpdateIdentityAssertionAuthorizationGrant],
3019 direction="write",
3020 ),
3021 "form_template": form_template,
3022 "addons": convert_and_respect_annotation_metadata(
3023 object_=addons, annotation=ClientAddons, direction="write"
3024 ),
3025 "client_metadata": client_metadata,
3026 "mobile": convert_and_respect_annotation_metadata(
3027 object_=mobile, annotation=ClientMobile, direction="write"
3028 ),
3029 "initiate_login_uri": initiate_login_uri,
3030 "native_social_login": convert_and_respect_annotation_metadata(
3031 object_=native_social_login, annotation=typing.Optional[NativeSocialLoginPatch], direction="write"
3032 ),
3033 "fedcm_login": convert_and_respect_annotation_metadata(
3034 object_=fedcm_login, annotation=typing.Optional[FedCmLoginPatch], direction="write"
3035 ),
3036 "refresh_token": convert_and_respect_annotation_metadata(
3037 object_=refresh_token,
3038 annotation=typing.Optional[ClientRefreshTokenConfiguration],
3039 direction="write",
3040 ),
3041 "default_organization": convert_and_respect_annotation_metadata(
3042 object_=default_organization,
3043 annotation=typing.Optional[ClientDefaultOrganization],
3044 direction="write",
3045 ),
3046 "organization_usage": organization_usage,
3047 "organization_require_behavior": organization_require_behavior,
3048 "organization_discovery_methods": organization_discovery_methods,
3049 "client_authentication_methods": convert_and_respect_annotation_metadata(
3050 object_=client_authentication_methods,
3051 annotation=typing.Optional[ClientAuthenticationMethod],
3052 direction="write",
3053 ),
3054 "require_pushed_authorization_requests": require_pushed_authorization_requests,
3055 "require_proof_of_possession": require_proof_of_possession,
3056 "signed_request_object": convert_and_respect_annotation_metadata(
3057 object_=signed_request_object,
3058 annotation=ClientSignedRequestObjectWithCredentialId,
3059 direction="write",
3060 ),
3061 "token_vault_privileged_access": convert_and_respect_annotation_metadata(
3062 object_=token_vault_privileged_access,
3063 annotation=ClientTokenVaultPrivilegedAccessWithCredentialId,
3064 direction="write",
3065 ),
3066 "compliance_level": compliance_level,
3067 "skip_non_verifiable_callback_uri_confirmation_prompt": skip_non_verifiable_callback_uri_confirmation_prompt,
3068 "token_exchange": convert_and_respect_annotation_metadata(
3069 object_=token_exchange,
3070 annotation=typing.Optional[ClientTokenExchangeConfigurationOrNull],
3071 direction="write",
3072 ),
3073 "par_request_expiry": par_request_expiry,
3074 "express_configuration": convert_and_respect_annotation_metadata(
3075 object_=express_configuration,
3076 annotation=typing.Optional[ExpressConfigurationOrNull],
3077 direction="write",
3078 ),
3079 "my_organization_configuration": convert_and_respect_annotation_metadata(
3080 object_=my_organization_configuration,
3081 annotation=typing.Optional[ClientMyOrganizationPatchConfiguration],
3082 direction="write",
3083 ),
3084 "async_approval_notification_channels": async_approval_notification_channels,
3085 "third_party_security_mode": third_party_security_mode,
3086 "redirection_policy": redirection_policy,
3087 },
3088 headers={
3089 "content-type": "application/json",
3090 },
3091 request_options=request_options,
3092 omit=OMIT,
3093 )
3094 try:
3095 if 200 <= _response.status_code < 300:
3096 _data = typing.cast(
3097 UpdateClientResponseContent,
3098 parse_obj_as(
3099 type_=UpdateClientResponseContent, # type: ignore
3100 object_=_response.json(),
3101 ),
3102 )
3103 return AsyncHttpResponse(response=_response, data=_data)
3104 if _response.status_code == 400:
3105 raise BadRequestError(
3106 headers=dict(_response.headers),
3107 body=typing.cast(
3108 typing.Any,
3109 parse_obj_as(
3110 type_=typing.Any, # type: ignore
3111 object_=_response.json(),
3112 ),
3113 ),
3114 )
3115 if _response.status_code == 401:
3116 raise UnauthorizedError(
3117 headers=dict(_response.headers),
3118 body=typing.cast(
3119 typing.Any,
3120 parse_obj_as(
3121 type_=typing.Any, # type: ignore
3122 object_=_response.json(),
3123 ),
3124 ),
3125 )
3126 if _response.status_code == 403:
3127 raise ForbiddenError(
3128 headers=dict(_response.headers),
3129 body=typing.cast(
3130 typing.Any,
3131 parse_obj_as(
3132 type_=typing.Any, # type: ignore
3133 object_=_response.json(),
3134 ),
3135 ),
3136 )
3137 if _response.status_code == 404:
3138 raise NotFoundError(
3139 headers=dict(_response.headers),
3140 body=typing.cast(
3141 typing.Any,
3142 parse_obj_as(
3143 type_=typing.Any, # type: ignore
3144 object_=_response.json(),
3145 ),
3146 ),
3147 )
3148 if _response.status_code == 429:
3149 raise TooManyRequestsError(
3150 headers=dict(_response.headers),
3151 body=typing.cast(
3152 typing.Any,
3153 parse_obj_as(
3154 type_=typing.Any, # type: ignore
3155 object_=_response.json(),
3156 ),
3157 ),
3158 )
3159 _response_json = _response.json()
3160 except JSONDecodeError:
3161 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3162 except ValidationError as e:
3163 raise ParsingError(
3164 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
3165 )
3166 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3167
3168 async def rotate_secret(
3169 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
3170 ) -> AsyncHttpResponse[RotateClientSecretResponseContent]:
3171 """
3172 Rotate a client secret.
3173
3174 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.
3175
3176 For more information, read [Rotate Client Secrets](https://www.auth0.com/docs/get-started/applications/rotate-client-secret).
3177
3178 Parameters
3179 ----------
3180 id : str
3181 ID of the client that will rotate secrets.
3182
3183 request_options : typing.Optional[RequestOptions]
3184 Request-specific configuration.
3185
3186 Returns
3187 -------
3188 AsyncHttpResponse[RotateClientSecretResponseContent]
3189 Secret successfully rotated.
3190 """
3191 _response = await self._client_wrapper.httpx_client.request(
3192 f"clients/{encode_path_param(id)}/rotate-secret",
3193 method="POST",
3194 request_options=request_options,
3195 )
3196 try:
3197 if 200 <= _response.status_code < 300:
3198 _data = typing.cast(
3199 RotateClientSecretResponseContent,
3200 parse_obj_as(
3201 type_=RotateClientSecretResponseContent, # type: ignore
3202 object_=_response.json(),
3203 ),
3204 )
3205 return AsyncHttpResponse(response=_response, data=_data)
3206 if _response.status_code == 400:
3207 raise BadRequestError(
3208 headers=dict(_response.headers),
3209 body=typing.cast(
3210 typing.Any,
3211 parse_obj_as(
3212 type_=typing.Any, # type: ignore
3213 object_=_response.json(),
3214 ),
3215 ),
3216 )
3217 if _response.status_code == 401:
3218 raise UnauthorizedError(
3219 headers=dict(_response.headers),
3220 body=typing.cast(
3221 typing.Any,
3222 parse_obj_as(
3223 type_=typing.Any, # type: ignore
3224 object_=_response.json(),
3225 ),
3226 ),
3227 )
3228 if _response.status_code == 403:
3229 raise ForbiddenError(
3230 headers=dict(_response.headers),
3231 body=typing.cast(
3232 typing.Any,
3233 parse_obj_as(
3234 type_=typing.Any, # type: ignore
3235 object_=_response.json(),
3236 ),
3237 ),
3238 )
3239 if _response.status_code == 404:
3240 raise NotFoundError(
3241 headers=dict(_response.headers),
3242 body=typing.cast(
3243 typing.Any,
3244 parse_obj_as(
3245 type_=typing.Any, # type: ignore
3246 object_=_response.json(),
3247 ),
3248 ),
3249 )
3250 if _response.status_code == 429:
3251 raise TooManyRequestsError(
3252 headers=dict(_response.headers),
3253 body=typing.cast(
3254 typing.Any,
3255 parse_obj_as(
3256 type_=typing.Any, # type: ignore
3257 object_=_response.json(),
3258 ),
3259 ),
3260 )
3261 _response_json = _response.json()
3262 except JSONDecodeError:
3263 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3264 except ValidationError as e:
3265 raise ParsingError(
3266 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
3267 )
3268 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)