| 1 |
|
| 2 |
|
| 3 |
import datetime as dt |
| 4 |
import typing |
| 5 |
|
| 6 |
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 7 |
from ...core.request_options import RequestOptions |
| 8 |
from ...types.client_credential import ClientCredential |
| 9 |
from ...types.client_credential_type_enum import ClientCredentialTypeEnum |
| 10 |
from ...types.get_client_credential_response_content import GetClientCredentialResponseContent |
| 11 |
from ...types.patch_client_credential_response_content import PatchClientCredentialResponseContent |
| 12 |
from ...types.post_client_credential_response_content import PostClientCredentialResponseContent |
| 13 |
from ...types.public_key_credential_algorithm_enum import PublicKeyCredentialAlgorithmEnum |
| 14 |
from .raw_client import AsyncRawCredentialsClient, RawCredentialsClient |
| 15 |
|
| 16 |
|
| 17 |
OMIT = typing.cast(typing.Any, ...) |
| 18 |
|
| 19 |
|
| 20 |
class CredentialsClient: |
| 21 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 22 |
self._raw_client = RawCredentialsClient(client_wrapper=client_wrapper) |
| 23 |
|
| 24 |
@property |
| 25 |
def with_raw_response(self) -> RawCredentialsClient: |
| 26 |
""" |
| 27 |
Retrieves a raw implementation of this client that returns raw responses. |
| 28 |
|
| 29 |
Returns |
| 30 |
------- |
| 31 |
RawCredentialsClient |
| 32 |
""" |
| 33 |
return self._raw_client |
| 34 |
|
| 35 |
def list( |
| 36 |
self, client_id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 37 |
) -> typing.List[ClientCredential]: |
| 38 |
""" |
| 39 |
Get the details of a client credential. |
| 40 |
|
| 41 |
**Important**: To enable credentials to be used for a client authentication method, set the `client_authentication_methods` property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the `signed_request_object` property on the client. |
| 42 |
|
| 43 |
Parameters |
| 44 |
---------- |
| 45 |
client_id : str |
| 46 |
ID of the client. |
| 47 |
|
| 48 |
request_options : typing.Optional[RequestOptions] |
| 49 |
Request-specific configuration. |
| 50 |
|
| 51 |
Returns |
| 52 |
------- |
| 53 |
typing.List[ClientCredential] |
| 54 |
Credentials successfully retrieved. |
| 55 |
|
| 56 |
Examples |
| 57 |
-------- |
| 58 |
from auth0 import Auth0 |
| 59 |
|
| 60 |
client = Auth0( |
| 61 |
token="YOUR_TOKEN", |
| 62 |
) |
| 63 |
client.clients.credentials.list( |
| 64 |
client_id="client_id", |
| 65 |
) |
| 66 |
""" |
| 67 |
_response = self._raw_client.list(client_id, request_options=request_options) |
| 68 |
return _response.data |
| 69 |
|
| 70 |
def create( |
| 71 |
self, |
| 72 |
client_id: str, |
| 73 |
*, |
| 74 |
credential_type: ClientCredentialTypeEnum, |
| 75 |
name: typing.Optional[str] = OMIT, |
| 76 |
subject_dn: typing.Optional[str] = OMIT, |
| 77 |
pem: typing.Optional[str] = OMIT, |
| 78 |
alg: typing.Optional[PublicKeyCredentialAlgorithmEnum] = OMIT, |
| 79 |
parse_expiry_from_cert: typing.Optional[bool] = OMIT, |
| 80 |
expires_at: typing.Optional[dt.datetime] = OMIT, |
| 81 |
kid: typing.Optional[str] = OMIT, |
| 82 |
request_options: typing.Optional[RequestOptions] = None, |
| 83 |
) -> PostClientCredentialResponseContent: |
| 84 |
""" |
| 85 |
Create a client credential associated to your application. Credentials can be used to configure Private Key JWT and mTLS authentication methods, as well as for JWT-secured Authorization requests. |
| 86 |
|
| 87 |
**Public Key** |
| 88 |
|
| 89 |
Public Key credentials can be used to set up Private Key JWT client authentication and JWT-secured Authorization requests. |
| 90 |
|
| 91 |
Sample: |
| 92 |
|
| 93 |
```json |
| 94 |
{ |
| 95 |
"credential_type": "public_key", |
| 96 |
"name": "string", |
| 97 |
"pem": "string", |
| 98 |
"alg": "RS256", |
| 99 |
"parse_expiry_from_cert": false, |
| 100 |
"expires_at": "2022-12-31T23:59:59Z" |
| 101 |
} |
| 102 |
``` |
| 103 |
|
| 104 |
**Certificate (CA-signed & self-signed)** |
| 105 |
|
| 106 |
Certificate credentials can be used to set up mTLS client authentication. CA-signed certificates can be configured either with a signed certificate or with just the certificate Subject DN. |
| 107 |
|
| 108 |
CA-signed Certificate Sample (pem): |
| 109 |
|
| 110 |
```json |
| 111 |
{ |
| 112 |
"credential_type": "x509_cert", |
| 113 |
"name": "string", |
| 114 |
"pem": "string" |
| 115 |
} |
| 116 |
``` |
| 117 |
|
| 118 |
CA-signed Certificate Sample (subject_dn): |
| 119 |
|
| 120 |
```json |
| 121 |
{ |
| 122 |
"credential_type": "cert_subject_dn", |
| 123 |
"name": "string", |
| 124 |
"subject_dn": "string" |
| 125 |
} |
| 126 |
``` |
| 127 |
|
| 128 |
Self-signed Certificate Sample: |
| 129 |
|
| 130 |
```json |
| 131 |
{ |
| 132 |
"credential_type": "cert_subject_dn", |
| 133 |
"name": "string", |
| 134 |
"pem": "string" |
| 135 |
} |
| 136 |
``` |
| 137 |
|
| 138 |
The credential will be created but not yet enabled for use until you set the corresponding properties in the client: |
| 139 |
|
| 140 |
- To enable the credential for Private Key JWT or mTLS authentication methods, set the `client_authentication_methods` property on the client. For more information, read [Configure Private Key JWT Authentication](https://auth0.com/docs/get-started/applications/configure-private-key-jwt) and [Configure mTLS Authentication](https://auth0.com/docs/get-started/applications/configure-mtls) |
| 141 |
- To enable the credential for JWT-secured Authorization requests, set the `signed_request_object`property on the client. For more information, read [Configure JWT-secured Authorization Requests (JAR)](https://auth0.com/docs/get-started/applications/configure-jar) |
| 142 |
|
| 143 |
Parameters |
| 144 |
---------- |
| 145 |
client_id : str |
| 146 |
ID of the client. |
| 147 |
|
| 148 |
credential_type : ClientCredentialTypeEnum |
| 149 |
|
| 150 |
name : typing.Optional[str] |
| 151 |
Friendly name for a credential. |
| 152 |
|
| 153 |
subject_dn : typing.Optional[str] |
| 154 |
Subject Distinguished Name. Mutually exclusive with `pem` property. Applies to `cert_subject_dn` credential type. |
| 155 |
|
| 156 |
pem : typing.Optional[str] |
| 157 |
PEM-formatted public key (SPKI and PKCS1) or X509 certificate. Must be JSON escaped. |
| 158 |
|
| 159 |
alg : typing.Optional[PublicKeyCredentialAlgorithmEnum] |
| 160 |
|
| 161 |
parse_expiry_from_cert : typing.Optional[bool] |
| 162 |
Parse expiry from x509 certificate. If true, attempts to parse the expiry date from the provided PEM. Applies to `public_key` credential type. |
| 163 |
|
| 164 |
expires_at : typing.Optional[dt.datetime] |
| 165 |
The ISO 8601 formatted date representing the expiration of the credential. If not specified (not recommended), the credential never expires. Applies to `public_key` credential type. |
| 166 |
|
| 167 |
kid : typing.Optional[str] |
| 168 |
Optional kid (Key ID), used to uniquely identify the credential. If not specified, a kid value will be auto-generated. The kid header parameter in JWTs sent by your client should match this value. Valid format is [0-9a-zA-Z-_]{10,64} |
| 169 |
|
| 170 |
request_options : typing.Optional[RequestOptions] |
| 171 |
Request-specific configuration. |
| 172 |
|
| 173 |
Returns |
| 174 |
------- |
| 175 |
PostClientCredentialResponseContent |
| 176 |
Credential successfully created. |
| 177 |
|
| 178 |
Examples |
| 179 |
-------- |
| 180 |
from auth0 import Auth0 |
| 181 |
|
| 182 |
client = Auth0( |
| 183 |
token="YOUR_TOKEN", |
| 184 |
) |
| 185 |
client.clients.credentials.create( |
| 186 |
client_id="client_id", |
| 187 |
credential_type="public_key", |
| 188 |
) |
| 189 |
""" |
| 190 |
_response = self._raw_client.create( |
| 191 |
client_id, |
| 192 |
credential_type=credential_type, |
| 193 |
name=name, |
| 194 |
subject_dn=subject_dn, |
| 195 |
pem=pem, |
| 196 |
alg=alg, |
| 197 |
parse_expiry_from_cert=parse_expiry_from_cert, |
| 198 |
expires_at=expires_at, |
| 199 |
kid=kid, |
| 200 |
request_options=request_options, |
| 201 |
) |
| 202 |
return _response.data |
| 203 |
|
| 204 |
def get( |
| 205 |
self, client_id: str, credential_id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 206 |
) -> GetClientCredentialResponseContent: |
| 207 |
""" |
| 208 |
Get the details of a client credential. |
| 209 |
|
| 210 |
**Important**: To enable credentials to be used for a client authentication method, set the `client_authentication_methods` property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the `signed_request_object` property on the client. |
| 211 |
|
| 212 |
Parameters |
| 213 |
---------- |
| 214 |
client_id : str |
| 215 |
ID of the client. |
| 216 |
|
| 217 |
credential_id : str |
| 218 |
ID of the credential. |
| 219 |
|
| 220 |
request_options : typing.Optional[RequestOptions] |
| 221 |
Request-specific configuration. |
| 222 |
|
| 223 |
Returns |
| 224 |
------- |
| 225 |
GetClientCredentialResponseContent |
| 226 |
Credential successfully retrieved. |
| 227 |
|
| 228 |
Examples |
| 229 |
-------- |
| 230 |
from auth0 import Auth0 |
| 231 |
|
| 232 |
client = Auth0( |
| 233 |
token="YOUR_TOKEN", |
| 234 |
) |
| 235 |
client.clients.credentials.get( |
| 236 |
client_id="client_id", |
| 237 |
credential_id="credential_id", |
| 238 |
) |
| 239 |
""" |
| 240 |
_response = self._raw_client.get(client_id, credential_id, request_options=request_options) |
| 241 |
return _response.data |
| 242 |
|
| 243 |
def delete( |
| 244 |
self, client_id: str, credential_id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 245 |
) -> None: |
| 246 |
""" |
| 247 |
Delete a client credential you previously created. May be enabled or disabled. For more information, read <a href="https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow">Client Credential Flow</a>. |
| 248 |
|
| 249 |
Parameters |
| 250 |
---------- |
| 251 |
client_id : str |
| 252 |
ID of the client. |
| 253 |
|
| 254 |
credential_id : str |
| 255 |
ID of the credential to delete. |
| 256 |
|
| 257 |
request_options : typing.Optional[RequestOptions] |
| 258 |
Request-specific configuration. |
| 259 |
|
| 260 |
Returns |
| 261 |
------- |
| 262 |
None |
| 263 |
|
| 264 |
Examples |
| 265 |
-------- |
| 266 |
from auth0 import Auth0 |
| 267 |
|
| 268 |
client = Auth0( |
| 269 |
token="YOUR_TOKEN", |
| 270 |
) |
| 271 |
client.clients.credentials.delete( |
| 272 |
client_id="client_id", |
| 273 |
credential_id="credential_id", |
| 274 |
) |
| 275 |
""" |
| 276 |
_response = self._raw_client.delete(client_id, credential_id, request_options=request_options) |
| 277 |
return _response.data |
| 278 |
|
| 279 |
def update( |
| 280 |
self, |
| 281 |
client_id: str, |
| 282 |
credential_id: str, |
| 283 |
*, |
| 284 |
expires_at: typing.Optional[dt.datetime] = OMIT, |
| 285 |
request_options: typing.Optional[RequestOptions] = None, |
| 286 |
) -> PatchClientCredentialResponseContent: |
| 287 |
""" |
| 288 |
Change a client credential you previously created. May be enabled or disabled. For more information, read <a href="https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow">Client Credential Flow</a>. |
| 289 |
|
| 290 |
Parameters |
| 291 |
---------- |
| 292 |
client_id : str |
| 293 |
ID of the client. |
| 294 |
|
| 295 |
credential_id : str |
| 296 |
ID of the credential. |
| 297 |
|
| 298 |
expires_at : typing.Optional[dt.datetime] |
| 299 |
The ISO 8601 formatted date representing the expiration of the credential. |
| 300 |
|
| 301 |
request_options : typing.Optional[RequestOptions] |
| 302 |
Request-specific configuration. |
| 303 |
|
| 304 |
Returns |
| 305 |
------- |
| 306 |
PatchClientCredentialResponseContent |
| 307 |
Credential successfully updated. |
| 308 |
|
| 309 |
Examples |
| 310 |
-------- |
| 311 |
from auth0 import Auth0 |
| 312 |
|
| 313 |
client = Auth0( |
| 314 |
token="YOUR_TOKEN", |
| 315 |
) |
| 316 |
client.clients.credentials.update( |
| 317 |
client_id="client_id", |
| 318 |
credential_id="credential_id", |
| 319 |
) |
| 320 |
""" |
| 321 |
_response = self._raw_client.update( |
| 322 |
client_id, credential_id, expires_at=expires_at, request_options=request_options |
| 323 |
) |
| 324 |
return _response.data |
| 325 |
|
| 326 |
|
| 327 |
class AsyncCredentialsClient: |
| 328 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 329 |
self._raw_client = AsyncRawCredentialsClient(client_wrapper=client_wrapper) |
| 330 |
|
| 331 |
@property |
| 332 |
def with_raw_response(self) -> AsyncRawCredentialsClient: |
| 333 |
""" |
| 334 |
Retrieves a raw implementation of this client that returns raw responses. |
| 335 |
|
| 336 |
Returns |
| 337 |
------- |
| 338 |
AsyncRawCredentialsClient |
| 339 |
""" |
| 340 |
return self._raw_client |
| 341 |
|
| 342 |
async def list( |
| 343 |
self, client_id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 344 |
) -> typing.List[ClientCredential]: |
| 345 |
""" |
| 346 |
Get the details of a client credential. |
| 347 |
|
| 348 |
**Important**: To enable credentials to be used for a client authentication method, set the `client_authentication_methods` property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the `signed_request_object` property on the client. |
| 349 |
|
| 350 |
Parameters |
| 351 |
---------- |
| 352 |
client_id : str |
| 353 |
ID of the client. |
| 354 |
|
| 355 |
request_options : typing.Optional[RequestOptions] |
| 356 |
Request-specific configuration. |
| 357 |
|
| 358 |
Returns |
| 359 |
------- |
| 360 |
typing.List[ClientCredential] |
| 361 |
Credentials successfully retrieved. |
| 362 |
|
| 363 |
Examples |
| 364 |
-------- |
| 365 |
import asyncio |
| 366 |
|
| 367 |
from auth0 import AsyncAuth0 |
| 368 |
|
| 369 |
client = AsyncAuth0( |
| 370 |
token="YOUR_TOKEN", |
| 371 |
) |
| 372 |
|
| 373 |
|
| 374 |
async def main() -> None: |
| 375 |
await client.clients.credentials.list( |
| 376 |
client_id="client_id", |
| 377 |
) |
| 378 |
|
| 379 |
|
| 380 |
asyncio.run(main()) |
| 381 |
""" |
| 382 |
_response = await self._raw_client.list(client_id, request_options=request_options) |
| 383 |
return _response.data |
| 384 |
|
| 385 |
async def create( |
| 386 |
self, |
| 387 |
client_id: str, |
| 388 |
*, |
| 389 |
credential_type: ClientCredentialTypeEnum, |
| 390 |
name: typing.Optional[str] = OMIT, |
| 391 |
subject_dn: typing.Optional[str] = OMIT, |
| 392 |
pem: typing.Optional[str] = OMIT, |
| 393 |
alg: typing.Optional[PublicKeyCredentialAlgorithmEnum] = OMIT, |
| 394 |
parse_expiry_from_cert: typing.Optional[bool] = OMIT, |
| 395 |
expires_at: typing.Optional[dt.datetime] = OMIT, |
| 396 |
kid: typing.Optional[str] = OMIT, |
| 397 |
request_options: typing.Optional[RequestOptions] = None, |
| 398 |
) -> PostClientCredentialResponseContent: |
| 399 |
""" |
| 400 |
Create a client credential associated to your application. Credentials can be used to configure Private Key JWT and mTLS authentication methods, as well as for JWT-secured Authorization requests. |
| 401 |
|
| 402 |
**Public Key** |
| 403 |
|
| 404 |
Public Key credentials can be used to set up Private Key JWT client authentication and JWT-secured Authorization requests. |
| 405 |
|
| 406 |
Sample: |
| 407 |
|
| 408 |
```json |
| 409 |
{ |
| 410 |
"credential_type": "public_key", |
| 411 |
"name": "string", |
| 412 |
"pem": "string", |
| 413 |
"alg": "RS256", |
| 414 |
"parse_expiry_from_cert": false, |
| 415 |
"expires_at": "2022-12-31T23:59:59Z" |
| 416 |
} |
| 417 |
``` |
| 418 |
|
| 419 |
**Certificate (CA-signed & self-signed)** |
| 420 |
|
| 421 |
Certificate credentials can be used to set up mTLS client authentication. CA-signed certificates can be configured either with a signed certificate or with just the certificate Subject DN. |
| 422 |
|
| 423 |
CA-signed Certificate Sample (pem): |
| 424 |
|
| 425 |
```json |
| 426 |
{ |
| 427 |
"credential_type": "x509_cert", |
| 428 |
"name": "string", |
| 429 |
"pem": "string" |
| 430 |
} |
| 431 |
``` |
| 432 |
|
| 433 |
CA-signed Certificate Sample (subject_dn): |
| 434 |
|
| 435 |
```json |
| 436 |
{ |
| 437 |
"credential_type": "cert_subject_dn", |
| 438 |
"name": "string", |
| 439 |
"subject_dn": "string" |
| 440 |
} |
| 441 |
``` |
| 442 |
|
| 443 |
Self-signed Certificate Sample: |
| 444 |
|
| 445 |
```json |
| 446 |
{ |
| 447 |
"credential_type": "cert_subject_dn", |
| 448 |
"name": "string", |
| 449 |
"pem": "string" |
| 450 |
} |
| 451 |
``` |
| 452 |
|
| 453 |
The credential will be created but not yet enabled for use until you set the corresponding properties in the client: |
| 454 |
|
| 455 |
- To enable the credential for Private Key JWT or mTLS authentication methods, set the `client_authentication_methods` property on the client. For more information, read [Configure Private Key JWT Authentication](https://auth0.com/docs/get-started/applications/configure-private-key-jwt) and [Configure mTLS Authentication](https://auth0.com/docs/get-started/applications/configure-mtls) |
| 456 |
- To enable the credential for JWT-secured Authorization requests, set the `signed_request_object`property on the client. For more information, read [Configure JWT-secured Authorization Requests (JAR)](https://auth0.com/docs/get-started/applications/configure-jar) |
| 457 |
|
| 458 |
Parameters |
| 459 |
---------- |
| 460 |
client_id : str |
| 461 |
ID of the client. |
| 462 |
|
| 463 |
credential_type : ClientCredentialTypeEnum |
| 464 |
|
| 465 |
name : typing.Optional[str] |
| 466 |
Friendly name for a credential. |
| 467 |
|
| 468 |
subject_dn : typing.Optional[str] |
| 469 |
Subject Distinguished Name. Mutually exclusive with `pem` property. Applies to `cert_subject_dn` credential type. |
| 470 |
|
| 471 |
pem : typing.Optional[str] |
| 472 |
PEM-formatted public key (SPKI and PKCS1) or X509 certificate. Must be JSON escaped. |
| 473 |
|
| 474 |
alg : typing.Optional[PublicKeyCredentialAlgorithmEnum] |
| 475 |
|
| 476 |
parse_expiry_from_cert : typing.Optional[bool] |
| 477 |
Parse expiry from x509 certificate. If true, attempts to parse the expiry date from the provided PEM. Applies to `public_key` credential type. |
| 478 |
|
| 479 |
expires_at : typing.Optional[dt.datetime] |
| 480 |
The ISO 8601 formatted date representing the expiration of the credential. If not specified (not recommended), the credential never expires. Applies to `public_key` credential type. |
| 481 |
|
| 482 |
kid : typing.Optional[str] |
| 483 |
Optional kid (Key ID), used to uniquely identify the credential. If not specified, a kid value will be auto-generated. The kid header parameter in JWTs sent by your client should match this value. Valid format is [0-9a-zA-Z-_]{10,64} |
| 484 |
|
| 485 |
request_options : typing.Optional[RequestOptions] |
| 486 |
Request-specific configuration. |
| 487 |
|
| 488 |
Returns |
| 489 |
------- |
| 490 |
PostClientCredentialResponseContent |
| 491 |
Credential successfully created. |
| 492 |
|
| 493 |
Examples |
| 494 |
-------- |
| 495 |
import asyncio |
| 496 |
|
| 497 |
from auth0 import AsyncAuth0 |
| 498 |
|
| 499 |
client = AsyncAuth0( |
| 500 |
token="YOUR_TOKEN", |
| 501 |
) |
| 502 |
|
| 503 |
|
| 504 |
async def main() -> None: |
| 505 |
await client.clients.credentials.create( |
| 506 |
client_id="client_id", |
| 507 |
credential_type="public_key", |
| 508 |
) |
| 509 |
|
| 510 |
|
| 511 |
asyncio.run(main()) |
| 512 |
""" |
| 513 |
_response = await self._raw_client.create( |
| 514 |
client_id, |
| 515 |
credential_type=credential_type, |
| 516 |
name=name, |
| 517 |
subject_dn=subject_dn, |
| 518 |
pem=pem, |
| 519 |
alg=alg, |
| 520 |
parse_expiry_from_cert=parse_expiry_from_cert, |
| 521 |
expires_at=expires_at, |
| 522 |
kid=kid, |
| 523 |
request_options=request_options, |
| 524 |
) |
| 525 |
return _response.data |
| 526 |
|
| 527 |
async def get( |
| 528 |
self, client_id: str, credential_id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 529 |
) -> GetClientCredentialResponseContent: |
| 530 |
""" |
| 531 |
Get the details of a client credential. |
| 532 |
|
| 533 |
**Important**: To enable credentials to be used for a client authentication method, set the `client_authentication_methods` property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the `signed_request_object` property on the client. |
| 534 |
|
| 535 |
Parameters |
| 536 |
---------- |
| 537 |
client_id : str |
| 538 |
ID of the client. |
| 539 |
|
| 540 |
credential_id : str |
| 541 |
ID of the credential. |
| 542 |
|
| 543 |
request_options : typing.Optional[RequestOptions] |
| 544 |
Request-specific configuration. |
| 545 |
|
| 546 |
Returns |
| 547 |
------- |
| 548 |
GetClientCredentialResponseContent |
| 549 |
Credential successfully retrieved. |
| 550 |
|
| 551 |
Examples |
| 552 |
-------- |
| 553 |
import asyncio |
| 554 |
|
| 555 |
from auth0 import AsyncAuth0 |
| 556 |
|
| 557 |
client = AsyncAuth0( |
| 558 |
token="YOUR_TOKEN", |
| 559 |
) |
| 560 |
|
| 561 |
|
| 562 |
async def main() -> None: |
| 563 |
await client.clients.credentials.get( |
| 564 |
client_id="client_id", |
| 565 |
credential_id="credential_id", |
| 566 |
) |
| 567 |
|
| 568 |
|
| 569 |
asyncio.run(main()) |
| 570 |
""" |
| 571 |
_response = await self._raw_client.get(client_id, credential_id, request_options=request_options) |
| 572 |
return _response.data |
| 573 |
|
| 574 |
async def delete( |
| 575 |
self, client_id: str, credential_id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 576 |
) -> None: |
| 577 |
""" |
| 578 |
Delete a client credential you previously created. May be enabled or disabled. For more information, read <a href="https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow">Client Credential Flow</a>. |
| 579 |
|
| 580 |
Parameters |
| 581 |
---------- |
| 582 |
client_id : str |
| 583 |
ID of the client. |
| 584 |
|
| 585 |
credential_id : str |
| 586 |
ID of the credential to delete. |
| 587 |
|
| 588 |
request_options : typing.Optional[RequestOptions] |
| 589 |
Request-specific configuration. |
| 590 |
|
| 591 |
Returns |
| 592 |
------- |
| 593 |
None |
| 594 |
|
| 595 |
Examples |
| 596 |
-------- |
| 597 |
import asyncio |
| 598 |
|
| 599 |
from auth0 import AsyncAuth0 |
| 600 |
|
| 601 |
client = AsyncAuth0( |
| 602 |
token="YOUR_TOKEN", |
| 603 |
) |
| 604 |
|
| 605 |
|
| 606 |
async def main() -> None: |
| 607 |
await client.clients.credentials.delete( |
| 608 |
client_id="client_id", |
| 609 |
credential_id="credential_id", |
| 610 |
) |
| 611 |
|
| 612 |
|
| 613 |
asyncio.run(main()) |
| 614 |
""" |
| 615 |
_response = await self._raw_client.delete(client_id, credential_id, request_options=request_options) |
| 616 |
return _response.data |
| 617 |
|
| 618 |
async def update( |
| 619 |
self, |
| 620 |
client_id: str, |
| 621 |
credential_id: str, |
| 622 |
*, |
| 623 |
expires_at: typing.Optional[dt.datetime] = OMIT, |
| 624 |
request_options: typing.Optional[RequestOptions] = None, |
| 625 |
) -> PatchClientCredentialResponseContent: |
| 626 |
""" |
| 627 |
Change a client credential you previously created. May be enabled or disabled. For more information, read <a href="https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow">Client Credential Flow</a>. |
| 628 |
|
| 629 |
Parameters |
| 630 |
---------- |
| 631 |
client_id : str |
| 632 |
ID of the client. |
| 633 |
|
| 634 |
credential_id : str |
| 635 |
ID of the credential. |
| 636 |
|
| 637 |
expires_at : typing.Optional[dt.datetime] |
| 638 |
The ISO 8601 formatted date representing the expiration of the credential. |
| 639 |
|
| 640 |
request_options : typing.Optional[RequestOptions] |
| 641 |
Request-specific configuration. |
| 642 |
|
| 643 |
Returns |
| 644 |
------- |
| 645 |
PatchClientCredentialResponseContent |
| 646 |
Credential successfully updated. |
| 647 |
|
| 648 |
Examples |
| 649 |
-------- |
| 650 |
import asyncio |
| 651 |
|
| 652 |
from auth0 import AsyncAuth0 |
| 653 |
|
| 654 |
client = AsyncAuth0( |
| 655 |
token="YOUR_TOKEN", |
| 656 |
) |
| 657 |
|
| 658 |
|
| 659 |
async def main() -> None: |
| 660 |
await client.clients.credentials.update( |
| 661 |
client_id="client_id", |
| 662 |
credential_id="credential_id", |
| 663 |
) |
| 664 |
|
| 665 |
|
| 666 |
asyncio.run(main()) |
| 667 |
""" |
| 668 |
_response = await self._raw_client.update( |
| 669 |
client_id, credential_id, expires_at=expires_at, request_options=request_options |
| 670 |
) |
| 671 |
return _response.data |