|
27 | 27 | - [Secure Credentials Manager](#secure-credentials-manager) |
28 | 28 | - [Usage](#usage) |
29 | 29 | - [Requiring Authentication](#requiring-authentication) |
| 30 | + - [Other Credentials](#other-credentials) |
30 | 31 | - [Handling Credentials Manager exceptions](#handling-credentials-manager-exceptions) |
31 | 32 | - [Passkeys](#passkeys) |
32 | 33 | - [Bot Protection](#bot-protection) |
@@ -658,7 +659,7 @@ authentication |
658 | 659 |
|
659 | 660 | Use the Auth0 My Account API to manage the current user's account. |
660 | 661 |
|
661 | | -To call the My Account API, you need an access token issued specifically for this API, including any required scopes for the operations you want to perform. |
| 662 | +To call the My Account API, you need an access token issued specifically for this API, including any required scopes for the operations you want to perform. See [API credentials [EA]](#api-credentials-ea) to learn how to obtain one. |
662 | 663 |
|
663 | 664 | ### Enroll a new passkey |
664 | 665 |
|
@@ -846,6 +847,56 @@ AuthenticationLevel is an enum that defines the different levels of authenticati |
846 | 847 | - **WEAK**: Any biometric (e.g., fingerprint, iris, or face) on the device that meets or exceeds the requirements for Class 2 (formerly Weak), as defined by the Android CDD. |
847 | 848 | - **DEVICE_CREDENTIAL**: The non-biometric credential used to secure the device (i.e., PIN, pattern, or password). |
848 | 849 |
|
| 850 | + |
| 851 | +### Other Credentials |
| 852 | + |
| 853 | +#### API credentials [EA] |
| 854 | + |
| 855 | +> [!NOTE] |
| 856 | +> This feature is currently available in [Early Access](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages#early-access). Please reach out to Auth0 support to get it enabled for your tenant. |
| 857 | +
|
| 858 | +When the user logs in, you can request an access token for a specific API by passing its API identifier as the [audience](#specify-audience) value. The access token in the resulting credentials can then be used to make authenticated requests to that API. |
| 859 | + |
| 860 | +However, if you need an access token for a different API, you can exchange the [refresh token](https://auth0.com/docs/secure/tokens/refresh-tokens) for credentials containing an access token specific to this other API. |
| 861 | + |
| 862 | +> [!IMPORTANT] |
| 863 | +> Currently, only the Auth0 My Account API is supported. Support for other APIs will be added in the future. |
| 864 | +
|
| 865 | +```kotlin |
| 866 | + |
| 867 | +credentialsManager.getApiCredentials( |
| 868 | + audience = "https://example.com/me", scope = " create:me:authentication_methods", |
| 869 | + callback = object : Callback<APICredentials, CredentialsManagerException> { |
| 870 | + override fun onSuccess(result: APICredentials) { |
| 871 | + print("Obtained API credentials: $result") |
| 872 | + } |
| 873 | + |
| 874 | + override fun onFailure(error: CredentialsManagerException) { |
| 875 | + print("Failed with: $error") |
| 876 | + } |
| 877 | + }) |
| 878 | + |
| 879 | +``` |
| 880 | + |
| 881 | +<details> |
| 882 | + <summary>Using Coroutines</summary> |
| 883 | + |
| 884 | +```kotlin |
| 885 | + |
| 886 | + try { |
| 887 | + val result = credentialsManager.awaitApiCredentials( |
| 888 | + audience = "https://example.com/me", |
| 889 | + scope = "create:me:authentication_methods" |
| 890 | + ) |
| 891 | + print("Obtained API credentials: $result") |
| 892 | + } catch (error: CredentialsManagerException) { |
| 893 | + print("Failed with: $error") |
| 894 | + } |
| 895 | + |
| 896 | +``` |
| 897 | + |
| 898 | +</details> |
| 899 | + |
849 | 900 | ### Handling Credentials Manager exceptions |
850 | 901 |
|
851 | 902 | In the event that something happened while trying to save or retrieve the credentials, a `CredentialsManagerException` will be thrown. These are some of the expected failure scenarios: |
|
0 commit comments