| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
|
| 5 |
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 6 |
from ...core.pagination import AsyncPager, SyncPager |
| 7 |
from ...core.request_options import RequestOptions |
| 8 |
from ...types.create_user_authentication_method_response_content import CreateUserAuthenticationMethodResponseContent |
| 9 |
from ...types.created_user_authentication_method_type_enum import CreatedUserAuthenticationMethodTypeEnum |
| 10 |
from ...types.credential_device_type_enum import CredentialDeviceTypeEnum |
| 11 |
from ...types.get_user_authentication_method_response_content import GetUserAuthenticationMethodResponseContent |
| 12 |
from ...types.list_user_authentication_methods_offset_paginated_response_content import ( |
| 13 |
ListUserAuthenticationMethodsOffsetPaginatedResponseContent, |
| 14 |
) |
| 15 |
from ...types.preferred_authentication_method_enum import PreferredAuthenticationMethodEnum |
| 16 |
from ...types.set_user_authentication_method_response_content import SetUserAuthenticationMethodResponseContent |
| 17 |
from ...types.set_user_authentication_methods_request_content import SetUserAuthenticationMethodsRequestContent |
| 18 |
from ...types.update_user_authentication_method_response_content import UpdateUserAuthenticationMethodResponseContent |
| 19 |
from ...types.user_authentication_method import UserAuthenticationMethod |
| 20 |
from .raw_client import AsyncRawAuthenticationMethodsClient, RawAuthenticationMethodsClient |
| 21 |
|
| 22 |
|
| 23 |
OMIT = typing.cast(typing.Any, ...) |
| 24 |
|
| 25 |
|
| 26 |
class AuthenticationMethodsClient: |
| 27 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 28 |
self._raw_client = RawAuthenticationMethodsClient(client_wrapper=client_wrapper) |
| 29 |
|
| 30 |
@property |
| 31 |
def with_raw_response(self) -> RawAuthenticationMethodsClient: |
| 32 |
""" |
| 33 |
Retrieves a raw implementation of this client that returns raw responses. |
| 34 |
|
| 35 |
Returns |
| 36 |
------- |
| 37 |
RawAuthenticationMethodsClient |
| 38 |
""" |
| 39 |
return self._raw_client |
| 40 |
|
| 41 |
def list( |
| 42 |
self, |
| 43 |
id: str, |
| 44 |
*, |
| 45 |
page: typing.Optional[int] = 0, |
| 46 |
per_page: typing.Optional[int] = 50, |
| 47 |
include_totals: typing.Optional[bool] = True, |
| 48 |
request_options: typing.Optional[RequestOptions] = None, |
| 49 |
) -> SyncPager[UserAuthenticationMethod, ListUserAuthenticationMethodsOffsetPaginatedResponseContent]: |
| 50 |
""" |
| 51 |
Retrieve detailed list of authentication methods associated with a specified user. |
| 52 |
|
| 53 |
Parameters |
| 54 |
---------- |
| 55 |
id : str |
| 56 |
The ID of the user in question. |
| 57 |
|
| 58 |
page : typing.Optional[int] |
| 59 |
Page index of the results to return. First page is 0. Default is 0. |
| 60 |
|
| 61 |
per_page : typing.Optional[int] |
| 62 |
Number of results per page. Default is 50. |
| 63 |
|
| 64 |
include_totals : typing.Optional[bool] |
| 65 |
Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). |
| 66 |
|
| 67 |
request_options : typing.Optional[RequestOptions] |
| 68 |
Request-specific configuration. |
| 69 |
|
| 70 |
Returns |
| 71 |
------- |
| 72 |
SyncPager[UserAuthenticationMethod, ListUserAuthenticationMethodsOffsetPaginatedResponseContent] |
| 73 |
The authentication methods for the user were retrieved. |
| 74 |
|
| 75 |
Examples |
| 76 |
-------- |
| 77 |
from auth0 import Auth0 |
| 78 |
|
| 79 |
client = Auth0( |
| 80 |
token="YOUR_TOKEN", |
| 81 |
) |
| 82 |
response = client.users.authentication_methods.list( |
| 83 |
id="id", |
| 84 |
page=1, |
| 85 |
per_page=1, |
| 86 |
include_totals=True, |
| 87 |
) |
| 88 |
for item in response: |
| 89 |
yield item |
| 90 |
# alternatively, you can paginate page-by-page |
| 91 |
for page in response.iter_pages(): |
| 92 |
yield page |
| 93 |
""" |
| 94 |
return self._raw_client.list( |
| 95 |
id, page=page, per_page=per_page, include_totals=include_totals, request_options=request_options |
| 96 |
) |
| 97 |
|
| 98 |
def create( |
| 99 |
self, |
| 100 |
id: str, |
| 101 |
*, |
| 102 |
type: CreatedUserAuthenticationMethodTypeEnum, |
| 103 |
name: typing.Optional[str] = OMIT, |
| 104 |
totp_secret: typing.Optional[str] = OMIT, |
| 105 |
phone_number: typing.Optional[str] = OMIT, |
| 106 |
email: typing.Optional[str] = OMIT, |
| 107 |
preferred_authentication_method: typing.Optional[PreferredAuthenticationMethodEnum] = OMIT, |
| 108 |
key_id: typing.Optional[str] = OMIT, |
| 109 |
public_key: typing.Optional[str] = OMIT, |
| 110 |
aaguid: typing.Optional[str] = OMIT, |
| 111 |
relying_party_identifier: typing.Optional[str] = OMIT, |
| 112 |
credential_device_type: typing.Optional[CredentialDeviceTypeEnum] = OMIT, |
| 113 |
credential_backed_up: typing.Optional[bool] = OMIT, |
| 114 |
identity_user_id: typing.Optional[str] = OMIT, |
| 115 |
user_agent: typing.Optional[str] = OMIT, |
| 116 |
user_handle: typing.Optional[str] = OMIT, |
| 117 |
transports: typing.Optional[typing.Sequence[str]] = OMIT, |
| 118 |
request_options: typing.Optional[RequestOptions] = None, |
| 119 |
) -> CreateUserAuthenticationMethodResponseContent: |
| 120 |
""" |
| 121 |
Create an authentication method. Authentication methods created via this endpoint will be auto confirmed and should already have verification completed. |
| 122 |
|
| 123 |
Parameters |
| 124 |
---------- |
| 125 |
id : str |
| 126 |
The ID of the user to whom the new authentication method will be assigned. |
| 127 |
|
| 128 |
type : CreatedUserAuthenticationMethodTypeEnum |
| 129 |
|
| 130 |
name : typing.Optional[str] |
| 131 |
A human-readable label to identify the authentication method. |
| 132 |
|
| 133 |
totp_secret : typing.Optional[str] |
| 134 |
Base32 encoded secret for TOTP generation. |
| 135 |
|
| 136 |
phone_number : typing.Optional[str] |
| 137 |
Applies to phone authentication methods only. The destination phone number used to send verification codes via text and voice. |
| 138 |
|
| 139 |
email : typing.Optional[str] |
| 140 |
Applies to email authentication methods only. The email address used to send verification messages. |
| 141 |
|
| 142 |
preferred_authentication_method : typing.Optional[PreferredAuthenticationMethodEnum] |
| 143 |
|
| 144 |
key_id : typing.Optional[str] |
| 145 |
Applies to webauthn/passkey authentication methods only. The id of the credential. |
| 146 |
|
| 147 |
public_key : typing.Optional[str] |
| 148 |
Applies to webauthn/passkey authentication methods only. The public key, which is encoded as base64. |
| 149 |
|
| 150 |
aaguid : typing.Optional[str] |
| 151 |
Applies to passkeys only. Authenticator Attestation Globally Unique Identifier |
| 152 |
|
| 153 |
relying_party_identifier : typing.Optional[str] |
| 154 |
Applies to webauthn authentication methods only. The relying party identifier. |
| 155 |
|
| 156 |
credential_device_type : typing.Optional[CredentialDeviceTypeEnum] |
| 157 |
|
| 158 |
credential_backed_up : typing.Optional[bool] |
| 159 |
Applies to passkeys only. Whether the credential was backed up. |
| 160 |
|
| 161 |
identity_user_id : typing.Optional[str] |
| 162 |
Applies to passkeys only. The ID of the user identity linked with the authentication method. |
| 163 |
|
| 164 |
user_agent : typing.Optional[str] |
| 165 |
Applies to passkeys only. The user-agent of the browser used to create the passkey. |
| 166 |
|
| 167 |
user_handle : typing.Optional[str] |
| 168 |
Applies to passkeys only. The user handle of the user identity. |
| 169 |
|
| 170 |
transports : typing.Optional[typing.Sequence[str]] |
| 171 |
Applies to passkeys only. The transports used by clients to communicate with the authenticator. |
| 172 |
|
| 173 |
request_options : typing.Optional[RequestOptions] |
| 174 |
Request-specific configuration. |
| 175 |
|
| 176 |
Returns |
| 177 |
------- |
| 178 |
CreateUserAuthenticationMethodResponseContent |
| 179 |
Authentication method created. |
| 180 |
|
| 181 |
Examples |
| 182 |
-------- |
| 183 |
from auth0 import Auth0 |
| 184 |
|
| 185 |
client = Auth0( |
| 186 |
token="YOUR_TOKEN", |
| 187 |
) |
| 188 |
client.users.authentication_methods.create( |
| 189 |
id="id", |
| 190 |
type="phone", |
| 191 |
) |
| 192 |
""" |
| 193 |
_response = self._raw_client.create( |
| 194 |
id, |
| 195 |
type=type, |
| 196 |
name=name, |
| 197 |
totp_secret=totp_secret, |
| 198 |
phone_number=phone_number, |
| 199 |
email=email, |
| 200 |
preferred_authentication_method=preferred_authentication_method, |
| 201 |
key_id=key_id, |
| 202 |
public_key=public_key, |
| 203 |
aaguid=aaguid, |
| 204 |
relying_party_identifier=relying_party_identifier, |
| 205 |
credential_device_type=credential_device_type, |
| 206 |
credential_backed_up=credential_backed_up, |
| 207 |
identity_user_id=identity_user_id, |
| 208 |
user_agent=user_agent, |
| 209 |
user_handle=user_handle, |
| 210 |
transports=transports, |
| 211 |
request_options=request_options, |
| 212 |
) |
| 213 |
return _response.data |
| 214 |
|
| 215 |
def set( |
| 216 |
self, |
| 217 |
id: str, |
| 218 |
*, |
| 219 |
request: SetUserAuthenticationMethodsRequestContent, |
| 220 |
request_options: typing.Optional[RequestOptions] = None, |
| 221 |
) -> typing.List[SetUserAuthenticationMethodResponseContent]: |
| 222 |
""" |
| 223 |
Replace the specified user <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors"> authentication methods</a> with supplied values. |
| 224 |
|
| 225 |
<b>Note</b>: Authentication methods supplied through this action do not iterate on existing methods. Instead, any methods passed will overwrite the user’s existing settings. |
| 226 |
|
| 227 |
Parameters |
| 228 |
---------- |
| 229 |
id : str |
| 230 |
The ID of the user in question. |
| 231 |
|
| 232 |
request : SetUserAuthenticationMethodsRequestContent |
| 233 |
|
| 234 |
request_options : typing.Optional[RequestOptions] |
| 235 |
Request-specific configuration. |
| 236 |
|
| 237 |
Returns |
| 238 |
------- |
| 239 |
typing.List[SetUserAuthenticationMethodResponseContent] |
| 240 |
All authentication methods successfully updated. |
| 241 |
|
| 242 |
Examples |
| 243 |
-------- |
| 244 |
from auth0 import Auth0, SetUserAuthenticationMethods |
| 245 |
|
| 246 |
client = Auth0( |
| 247 |
token="YOUR_TOKEN", |
| 248 |
) |
| 249 |
client.users.authentication_methods.set( |
| 250 |
id="id", |
| 251 |
request=[ |
| 252 |
SetUserAuthenticationMethods( |
| 253 |
type="phone", |
| 254 |
) |
| 255 |
], |
| 256 |
) |
| 257 |
""" |
| 258 |
_response = self._raw_client.set(id, request=request, request_options=request_options) |
| 259 |
return _response.data |
| 260 |
|
| 261 |
def delete_all(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 262 |
""" |
| 263 |
Remove all authentication methods (i.e., enrolled MFA factors) from the specified user account. This action cannot be undone. |
| 264 |
|
| 265 |
Parameters |
| 266 |
---------- |
| 267 |
id : str |
| 268 |
The ID of the user in question. |
| 269 |
|
| 270 |
request_options : typing.Optional[RequestOptions] |
| 271 |
Request-specific configuration. |
| 272 |
|
| 273 |
Returns |
| 274 |
------- |
| 275 |
None |
| 276 |
|
| 277 |
Examples |
| 278 |
-------- |
| 279 |
from auth0 import Auth0 |
| 280 |
|
| 281 |
client = Auth0( |
| 282 |
token="YOUR_TOKEN", |
| 283 |
) |
| 284 |
client.users.authentication_methods.delete_all( |
| 285 |
id="id", |
| 286 |
) |
| 287 |
""" |
| 288 |
_response = self._raw_client.delete_all(id, request_options=request_options) |
| 289 |
return _response.data |
| 290 |
|
| 291 |
def get( |
| 292 |
self, id: str, authentication_method_id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 293 |
) -> GetUserAuthenticationMethodResponseContent: |
| 294 |
""" |
| 295 |
Parameters |
| 296 |
---------- |
| 297 |
id : str |
| 298 |
The ID of the user in question. |
| 299 |
|
| 300 |
authentication_method_id : str |
| 301 |
The ID of the authentication methods in question. |
| 302 |
|
| 303 |
request_options : typing.Optional[RequestOptions] |
| 304 |
Request-specific configuration. |
| 305 |
|
| 306 |
Returns |
| 307 |
------- |
| 308 |
GetUserAuthenticationMethodResponseContent |
| 309 |
Authentication method retrieved. |
| 310 |
|
| 311 |
Examples |
| 312 |
-------- |
| 313 |
from auth0 import Auth0 |
| 314 |
|
| 315 |
client = Auth0( |
| 316 |
token="YOUR_TOKEN", |
| 317 |
) |
| 318 |
client.users.authentication_methods.get( |
| 319 |
id="id", |
| 320 |
authentication_method_id="authentication_method_id", |
| 321 |
) |
| 322 |
""" |
| 323 |
_response = self._raw_client.get(id, authentication_method_id, request_options=request_options) |
| 324 |
return _response.data |
| 325 |
|
| 326 |
def delete( |
| 327 |
self, id: str, authentication_method_id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 328 |
) -> None: |
| 329 |
""" |
| 330 |
Remove the authentication method with the given ID from the specified user. For more information, review <a href="https://auth0.com/docs/secure/multi-factor-authentication/manage-mfa-auth0-apis/manage-authentication-methods-with-management-api">Manage Authentication Methods with Management API</a>. |
| 331 |
|
| 332 |
Parameters |
| 333 |
---------- |
| 334 |
id : str |
| 335 |
The ID of the user in question. |
| 336 |
|
| 337 |
authentication_method_id : str |
| 338 |
The ID of the authentication method to delete. |
| 339 |
|
| 340 |
request_options : typing.Optional[RequestOptions] |
| 341 |
Request-specific configuration. |
| 342 |
|
| 343 |
Returns |
| 344 |
------- |
| 345 |
None |
| 346 |
|
| 347 |
Examples |
| 348 |
-------- |
| 349 |
from auth0 import Auth0 |
| 350 |
|
| 351 |
client = Auth0( |
| 352 |
token="YOUR_TOKEN", |
| 353 |
) |
| 354 |
client.users.authentication_methods.delete( |
| 355 |
id="id", |
| 356 |
authentication_method_id="authentication_method_id", |
| 357 |
) |
| 358 |
""" |
| 359 |
_response = self._raw_client.delete(id, authentication_method_id, request_options=request_options) |
| 360 |
return _response.data |
| 361 |
|
| 362 |
def update( |
| 363 |
self, |
| 364 |
id: str, |
| 365 |
authentication_method_id: str, |
| 366 |
*, |
| 367 |
name: typing.Optional[str] = OMIT, |
| 368 |
preferred_authentication_method: typing.Optional[PreferredAuthenticationMethodEnum] = OMIT, |
| 369 |
request_options: typing.Optional[RequestOptions] = None, |
| 370 |
) -> UpdateUserAuthenticationMethodResponseContent: |
| 371 |
""" |
| 372 |
Modify the authentication method with the given ID from the specified user. For more information, review <a href="https://auth0.com/docs/secure/multi-factor-authentication/manage-mfa-auth0-apis/manage-authentication-methods-with-management-api">Manage Authentication Methods with Management API</a>. |
| 373 |
|
| 374 |
Parameters |
| 375 |
---------- |
| 376 |
id : str |
| 377 |
The ID of the user in question. |
| 378 |
|
| 379 |
authentication_method_id : str |
| 380 |
The ID of the authentication method to update. |
| 381 |
|
| 382 |
name : typing.Optional[str] |
| 383 |
A human-readable label to identify the authentication method. |
| 384 |
|
| 385 |
preferred_authentication_method : typing.Optional[PreferredAuthenticationMethodEnum] |
| 386 |
Preferred phone authentication method |
| 387 |
|
| 388 |
request_options : typing.Optional[RequestOptions] |
| 389 |
Request-specific configuration. |
| 390 |
|
| 391 |
Returns |
| 392 |
------- |
| 393 |
UpdateUserAuthenticationMethodResponseContent |
| 394 |
Authentication method updated. |
| 395 |
|
| 396 |
Examples |
| 397 |
-------- |
| 398 |
from auth0 import Auth0 |
| 399 |
|
| 400 |
client = Auth0( |
| 401 |
token="YOUR_TOKEN", |
| 402 |
) |
| 403 |
client.users.authentication_methods.update( |
| 404 |
id="id", |
| 405 |
authentication_method_id="authentication_method_id", |
| 406 |
) |
| 407 |
""" |
| 408 |
_response = self._raw_client.update( |
| 409 |
id, |
| 410 |
authentication_method_id, |
| 411 |
name=name, |
| 412 |
preferred_authentication_method=preferred_authentication_method, |
| 413 |
request_options=request_options, |
| 414 |
) |
| 415 |
return _response.data |
| 416 |
|
| 417 |
|
| 418 |
class AsyncAuthenticationMethodsClient: |
| 419 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 420 |
self._raw_client = AsyncRawAuthenticationMethodsClient(client_wrapper=client_wrapper) |
| 421 |
|
| 422 |
@property |
| 423 |
def with_raw_response(self) -> AsyncRawAuthenticationMethodsClient: |
| 424 |
""" |
| 425 |
Retrieves a raw implementation of this client that returns raw responses. |
| 426 |
|
| 427 |
Returns |
| 428 |
------- |
| 429 |
AsyncRawAuthenticationMethodsClient |
| 430 |
""" |
| 431 |
return self._raw_client |
| 432 |
|
| 433 |
async def list( |
| 434 |
self, |
| 435 |
id: str, |
| 436 |
*, |
| 437 |
page: typing.Optional[int] = 0, |
| 438 |
per_page: typing.Optional[int] = 50, |
| 439 |
include_totals: typing.Optional[bool] = True, |
| 440 |
request_options: typing.Optional[RequestOptions] = None, |
| 441 |
) -> AsyncPager[UserAuthenticationMethod, ListUserAuthenticationMethodsOffsetPaginatedResponseContent]: |
| 442 |
""" |
| 443 |
Retrieve detailed list of authentication methods associated with a specified user. |
| 444 |
|
| 445 |
Parameters |
| 446 |
---------- |
| 447 |
id : str |
| 448 |
The ID of the user in question. |
| 449 |
|
| 450 |
page : typing.Optional[int] |
| 451 |
Page index of the results to return. First page is 0. Default is 0. |
| 452 |
|
| 453 |
per_page : typing.Optional[int] |
| 454 |
Number of results per page. Default is 50. |
| 455 |
|
| 456 |
include_totals : typing.Optional[bool] |
| 457 |
Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). |
| 458 |
|
| 459 |
request_options : typing.Optional[RequestOptions] |
| 460 |
Request-specific configuration. |
| 461 |
|
| 462 |
Returns |
| 463 |
------- |
| 464 |
AsyncPager[UserAuthenticationMethod, ListUserAuthenticationMethodsOffsetPaginatedResponseContent] |
| 465 |
The authentication methods for the user were retrieved. |
| 466 |
|
| 467 |
Examples |
| 468 |
-------- |
| 469 |
import asyncio |
| 470 |
|
| 471 |
from auth0 import AsyncAuth0 |
| 472 |
|
| 473 |
client = AsyncAuth0( |
| 474 |
token="YOUR_TOKEN", |
| 475 |
) |
| 476 |
|
| 477 |
|
| 478 |
async def main() -> None: |
| 479 |
response = await client.users.authentication_methods.list( |
| 480 |
id="id", |
| 481 |
page=1, |
| 482 |
per_page=1, |
| 483 |
include_totals=True, |
| 484 |
) |
| 485 |
async for item in response: |
| 486 |
yield item |
| 487 |
|
| 488 |
# alternatively, you can paginate page-by-page |
| 489 |
async for page in response.iter_pages(): |
| 490 |
yield page |
| 491 |
|
| 492 |
|
| 493 |
asyncio.run(main()) |
| 494 |
""" |
| 495 |
return await self._raw_client.list( |
| 496 |
id, page=page, per_page=per_page, include_totals=include_totals, request_options=request_options |
| 497 |
) |
| 498 |
|
| 499 |
async def create( |
| 500 |
self, |
| 501 |
id: str, |
| 502 |
*, |
| 503 |
type: CreatedUserAuthenticationMethodTypeEnum, |
| 504 |
name: typing.Optional[str] = OMIT, |
| 505 |
totp_secret: typing.Optional[str] = OMIT, |
| 506 |
phone_number: typing.Optional[str] = OMIT, |
| 507 |
email: typing.Optional[str] = OMIT, |
| 508 |
preferred_authentication_method: typing.Optional[PreferredAuthenticationMethodEnum] = OMIT, |
| 509 |
key_id: typing.Optional[str] = OMIT, |
| 510 |
public_key: typing.Optional[str] = OMIT, |
| 511 |
aaguid: typing.Optional[str] = OMIT, |
| 512 |
relying_party_identifier: typing.Optional[str] = OMIT, |
| 513 |
credential_device_type: typing.Optional[CredentialDeviceTypeEnum] = OMIT, |
| 514 |
credential_backed_up: typing.Optional[bool] = OMIT, |
| 515 |
identity_user_id: typing.Optional[str] = OMIT, |
| 516 |
user_agent: typing.Optional[str] = OMIT, |
| 517 |
user_handle: typing.Optional[str] = OMIT, |
| 518 |
transports: typing.Optional[typing.Sequence[str]] = OMIT, |
| 519 |
request_options: typing.Optional[RequestOptions] = None, |
| 520 |
) -> CreateUserAuthenticationMethodResponseContent: |
| 521 |
""" |
| 522 |
Create an authentication method. Authentication methods created via this endpoint will be auto confirmed and should already have verification completed. |
| 523 |
|
| 524 |
Parameters |
| 525 |
---------- |
| 526 |
id : str |
| 527 |
The ID of the user to whom the new authentication method will be assigned. |
| 528 |
|
| 529 |
type : CreatedUserAuthenticationMethodTypeEnum |
| 530 |
|
| 531 |
name : typing.Optional[str] |
| 532 |
A human-readable label to identify the authentication method. |
| 533 |
|
| 534 |
totp_secret : typing.Optional[str] |
| 535 |
Base32 encoded secret for TOTP generation. |
| 536 |
|
| 537 |
phone_number : typing.Optional[str] |
| 538 |
Applies to phone authentication methods only. The destination phone number used to send verification codes via text and voice. |
| 539 |
|
| 540 |
email : typing.Optional[str] |
| 541 |
Applies to email authentication methods only. The email address used to send verification messages. |
| 542 |
|
| 543 |
preferred_authentication_method : typing.Optional[PreferredAuthenticationMethodEnum] |
| 544 |
|
| 545 |
key_id : typing.Optional[str] |
| 546 |
Applies to webauthn/passkey authentication methods only. The id of the credential. |
| 547 |
|
| 548 |
public_key : typing.Optional[str] |
| 549 |
Applies to webauthn/passkey authentication methods only. The public key, which is encoded as base64. |
| 550 |
|
| 551 |
aaguid : typing.Optional[str] |
| 552 |
Applies to passkeys only. Authenticator Attestation Globally Unique Identifier |
| 553 |
|
| 554 |
relying_party_identifier : typing.Optional[str] |
| 555 |
Applies to webauthn authentication methods only. The relying party identifier. |
| 556 |
|
| 557 |
credential_device_type : typing.Optional[CredentialDeviceTypeEnum] |
| 558 |
|
| 559 |
credential_backed_up : typing.Optional[bool] |
| 560 |
Applies to passkeys only. Whether the credential was backed up. |
| 561 |
|
| 562 |
identity_user_id : typing.Optional[str] |
| 563 |
Applies to passkeys only. The ID of the user identity linked with the authentication method. |
| 564 |
|
| 565 |
user_agent : typing.Optional[str] |
| 566 |
Applies to passkeys only. The user-agent of the browser used to create the passkey. |
| 567 |
|
| 568 |
user_handle : typing.Optional[str] |
| 569 |
Applies to passkeys only. The user handle of the user identity. |
| 570 |
|
| 571 |
transports : typing.Optional[typing.Sequence[str]] |
| 572 |
Applies to passkeys only. The transports used by clients to communicate with the authenticator. |
| 573 |
|
| 574 |
request_options : typing.Optional[RequestOptions] |
| 575 |
Request-specific configuration. |
| 576 |
|
| 577 |
Returns |
| 578 |
------- |
| 579 |
CreateUserAuthenticationMethodResponseContent |
| 580 |
Authentication method created. |
| 581 |
|
| 582 |
Examples |
| 583 |
-------- |
| 584 |
import asyncio |
| 585 |
|
| 586 |
from auth0 import AsyncAuth0 |
| 587 |
|
| 588 |
client = AsyncAuth0( |
| 589 |
token="YOUR_TOKEN", |
| 590 |
) |
| 591 |
|
| 592 |
|
| 593 |
async def main() -> None: |
| 594 |
await client.users.authentication_methods.create( |
| 595 |
id="id", |
| 596 |
type="phone", |
| 597 |
) |
| 598 |
|
| 599 |
|
| 600 |
asyncio.run(main()) |
| 601 |
""" |
| 602 |
_response = await self._raw_client.create( |
| 603 |
id, |
| 604 |
type=type, |
| 605 |
name=name, |
| 606 |
totp_secret=totp_secret, |
| 607 |
phone_number=phone_number, |
| 608 |
email=email, |
| 609 |
preferred_authentication_method=preferred_authentication_method, |
| 610 |
key_id=key_id, |
| 611 |
public_key=public_key, |
| 612 |
aaguid=aaguid, |
| 613 |
relying_party_identifier=relying_party_identifier, |
| 614 |
credential_device_type=credential_device_type, |
| 615 |
credential_backed_up=credential_backed_up, |
| 616 |
identity_user_id=identity_user_id, |
| 617 |
user_agent=user_agent, |
| 618 |
user_handle=user_handle, |
| 619 |
transports=transports, |
| 620 |
request_options=request_options, |
| 621 |
) |
| 622 |
return _response.data |
| 623 |
|
| 624 |
async def set( |
| 625 |
self, |
| 626 |
id: str, |
| 627 |
*, |
| 628 |
request: SetUserAuthenticationMethodsRequestContent, |
| 629 |
request_options: typing.Optional[RequestOptions] = None, |
| 630 |
) -> typing.List[SetUserAuthenticationMethodResponseContent]: |
| 631 |
""" |
| 632 |
Replace the specified user <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors"> authentication methods</a> with supplied values. |
| 633 |
|
| 634 |
<b>Note</b>: Authentication methods supplied through this action do not iterate on existing methods. Instead, any methods passed will overwrite the user’s existing settings. |
| 635 |
|
| 636 |
Parameters |
| 637 |
---------- |
| 638 |
id : str |
| 639 |
The ID of the user in question. |
| 640 |
|
| 641 |
request : SetUserAuthenticationMethodsRequestContent |
| 642 |
|
| 643 |
request_options : typing.Optional[RequestOptions] |
| 644 |
Request-specific configuration. |
| 645 |
|
| 646 |
Returns |
| 647 |
------- |
| 648 |
typing.List[SetUserAuthenticationMethodResponseContent] |
| 649 |
All authentication methods successfully updated. |
| 650 |
|
| 651 |
Examples |
| 652 |
-------- |
| 653 |
import asyncio |
| 654 |
|
| 655 |
from auth0 import AsyncAuth0, SetUserAuthenticationMethods |
| 656 |
|
| 657 |
client = AsyncAuth0( |
| 658 |
token="YOUR_TOKEN", |
| 659 |
) |
| 660 |
|
| 661 |
|
| 662 |
async def main() -> None: |
| 663 |
await client.users.authentication_methods.set( |
| 664 |
id="id", |
| 665 |
request=[ |
| 666 |
SetUserAuthenticationMethods( |
| 667 |
type="phone", |
| 668 |
) |
| 669 |
], |
| 670 |
) |
| 671 |
|
| 672 |
|
| 673 |
asyncio.run(main()) |
| 674 |
""" |
| 675 |
_response = await self._raw_client.set(id, request=request, request_options=request_options) |
| 676 |
return _response.data |
| 677 |
|
| 678 |
async def delete_all(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 679 |
""" |
| 680 |
Remove all authentication methods (i.e., enrolled MFA factors) from the specified user account. This action cannot be undone. |
| 681 |
|
| 682 |
Parameters |
| 683 |
---------- |
| 684 |
id : str |
| 685 |
The ID of the user in question. |
| 686 |
|
| 687 |
request_options : typing.Optional[RequestOptions] |
| 688 |
Request-specific configuration. |
| 689 |
|
| 690 |
Returns |
| 691 |
------- |
| 692 |
None |
| 693 |
|
| 694 |
Examples |
| 695 |
-------- |
| 696 |
import asyncio |
| 697 |
|
| 698 |
from auth0 import AsyncAuth0 |
| 699 |
|
| 700 |
client = AsyncAuth0( |
| 701 |
token="YOUR_TOKEN", |
| 702 |
) |
| 703 |
|
| 704 |
|
| 705 |
async def main() -> None: |
| 706 |
await client.users.authentication_methods.delete_all( |
| 707 |
id="id", |
| 708 |
) |
| 709 |
|
| 710 |
|
| 711 |
asyncio.run(main()) |
| 712 |
""" |
| 713 |
_response = await self._raw_client.delete_all(id, request_options=request_options) |
| 714 |
return _response.data |
| 715 |
|
| 716 |
async def get( |
| 717 |
self, id: str, authentication_method_id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 718 |
) -> GetUserAuthenticationMethodResponseContent: |
| 719 |
""" |
| 720 |
Parameters |
| 721 |
---------- |
| 722 |
id : str |
| 723 |
The ID of the user in question. |
| 724 |
|
| 725 |
authentication_method_id : str |
| 726 |
The ID of the authentication methods in question. |
| 727 |
|
| 728 |
request_options : typing.Optional[RequestOptions] |
| 729 |
Request-specific configuration. |
| 730 |
|
| 731 |
Returns |
| 732 |
------- |
| 733 |
GetUserAuthenticationMethodResponseContent |
| 734 |
Authentication method retrieved. |
| 735 |
|
| 736 |
Examples |
| 737 |
-------- |
| 738 |
import asyncio |
| 739 |
|
| 740 |
from auth0 import AsyncAuth0 |
| 741 |
|
| 742 |
client = AsyncAuth0( |
| 743 |
token="YOUR_TOKEN", |
| 744 |
) |
| 745 |
|
| 746 |
|
| 747 |
async def main() -> None: |
| 748 |
await client.users.authentication_methods.get( |
| 749 |
id="id", |
| 750 |
authentication_method_id="authentication_method_id", |
| 751 |
) |
| 752 |
|
| 753 |
|
| 754 |
asyncio.run(main()) |
| 755 |
""" |
| 756 |
_response = await self._raw_client.get(id, authentication_method_id, request_options=request_options) |
| 757 |
return _response.data |
| 758 |
|
| 759 |
async def delete( |
| 760 |
self, id: str, authentication_method_id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 761 |
) -> None: |
| 762 |
""" |
| 763 |
Remove the authentication method with the given ID from the specified user. For more information, review <a href="https://auth0.com/docs/secure/multi-factor-authentication/manage-mfa-auth0-apis/manage-authentication-methods-with-management-api">Manage Authentication Methods with Management API</a>. |
| 764 |
|
| 765 |
Parameters |
| 766 |
---------- |
| 767 |
id : str |
| 768 |
The ID of the user in question. |
| 769 |
|
| 770 |
authentication_method_id : str |
| 771 |
The ID of the authentication method to delete. |
| 772 |
|
| 773 |
request_options : typing.Optional[RequestOptions] |
| 774 |
Request-specific configuration. |
| 775 |
|
| 776 |
Returns |
| 777 |
------- |
| 778 |
None |
| 779 |
|
| 780 |
Examples |
| 781 |
-------- |
| 782 |
import asyncio |
| 783 |
|
| 784 |
from auth0 import AsyncAuth0 |
| 785 |
|
| 786 |
client = AsyncAuth0( |
| 787 |
token="YOUR_TOKEN", |
| 788 |
) |
| 789 |
|
| 790 |
|
| 791 |
async def main() -> None: |
| 792 |
await client.users.authentication_methods.delete( |
| 793 |
id="id", |
| 794 |
authentication_method_id="authentication_method_id", |
| 795 |
) |
| 796 |
|
| 797 |
|
| 798 |
asyncio.run(main()) |
| 799 |
""" |
| 800 |
_response = await self._raw_client.delete(id, authentication_method_id, request_options=request_options) |
| 801 |
return _response.data |
| 802 |
|
| 803 |
async def update( |
| 804 |
self, |
| 805 |
id: str, |
| 806 |
authentication_method_id: str, |
| 807 |
*, |
| 808 |
name: typing.Optional[str] = OMIT, |
| 809 |
preferred_authentication_method: typing.Optional[PreferredAuthenticationMethodEnum] = OMIT, |
| 810 |
request_options: typing.Optional[RequestOptions] = None, |
| 811 |
) -> UpdateUserAuthenticationMethodResponseContent: |
| 812 |
""" |
| 813 |
Modify the authentication method with the given ID from the specified user. For more information, review <a href="https://auth0.com/docs/secure/multi-factor-authentication/manage-mfa-auth0-apis/manage-authentication-methods-with-management-api">Manage Authentication Methods with Management API</a>. |
| 814 |
|
| 815 |
Parameters |
| 816 |
---------- |
| 817 |
id : str |
| 818 |
The ID of the user in question. |
| 819 |
|
| 820 |
authentication_method_id : str |
| 821 |
The ID of the authentication method to update. |
| 822 |
|
| 823 |
name : typing.Optional[str] |
| 824 |
A human-readable label to identify the authentication method. |
| 825 |
|
| 826 |
preferred_authentication_method : typing.Optional[PreferredAuthenticationMethodEnum] |
| 827 |
Preferred phone authentication method |
| 828 |
|
| 829 |
request_options : typing.Optional[RequestOptions] |
| 830 |
Request-specific configuration. |
| 831 |
|
| 832 |
Returns |
| 833 |
------- |
| 834 |
UpdateUserAuthenticationMethodResponseContent |
| 835 |
Authentication method updated. |
| 836 |
|
| 837 |
Examples |
| 838 |
-------- |
| 839 |
import asyncio |
| 840 |
|
| 841 |
from auth0 import AsyncAuth0 |
| 842 |
|
| 843 |
client = AsyncAuth0( |
| 844 |
token="YOUR_TOKEN", |
| 845 |
) |
| 846 |
|
| 847 |
|
| 848 |
async def main() -> None: |
| 849 |
await client.users.authentication_methods.update( |
| 850 |
id="id", |
| 851 |
authentication_method_id="authentication_method_id", |
| 852 |
) |
| 853 |
|
| 854 |
|
| 855 |
asyncio.run(main()) |
| 856 |
""" |
| 857 |
_response = await self._raw_client.update( |
| 858 |
id, |
| 859 |
authentication_method_id, |
| 860 |
name=name, |
| 861 |
preferred_authentication_method=preferred_authentication_method, |
| 862 |
request_options=request_options, |
| 863 |
) |
| 864 |
return _response.data |