- Constructor: The constructor of the
Auth0
class is now private. UseAuth0.getInstance(clientId, domain)
to get an instance. This method checks if an instance with the given configuration exists; if yes, it returns it, otherwise, it creates a new one.
- New Methods: Added multiple overloads of
getCredentials()
andawaitCredentials()
to theBaseCredentialsManager
interface. All implementations of this interface must now override these new methods.
- await Function: The
await
function of theRequest
interface is now abstract. All implementations must implement this method.
- Data Class: The
Credentials
class is now a data class and can no longer be extended. ThecurrentTimeInMillis
property has been removed.
- requireAuthentication Method: The
requireAuthentication
method, used to enable authentication before obtaining credentials, has been removed. Refer to the Enabling Authentication section for the new approach.
- Library Update: Implementation of biometrics authentication for retrieving credentials securely is now done using the
androidx.biometric.biometric
library.
- Enum Code: The
CredentialsManagerException
now contains an enum code. You can use awhen
expression to handle different error scenarios:
when (credentialsManagerException) {
CredentialsManagerException.NO_CREDENTIALS -> {
// handle no credentials scenario
}
CredentialsManagerException.NO_REFRESH_TOKEN -> {
// handle no refresh token scenario
}
CredentialsManagerException.STORE_FAILED -> {
// handle store failed scenario
}
// ... similarly for other error codes
}
To enable authentication before obtaining credentials, you need to pass the below to the constructor of SecureCredentialsManager
:
- An instance of
FragmentActivity
where the authentication prompt should be shown. - An instance of
LocalAuthenticationOptions
to configure details like the level of authentication (Strong, Weak), prompt title, etc.
private val localAuthenticationOptions = LocalAuthenticationOptions.Builder()
.setTitle("Authenticate to Access Credentials")
.setDescription("description")
.setAuthenticationLevel(AuthenticationLevel.STRONG)
.setDeviceCredentialFallback(true)
.build()
val storage = SharedPreferencesStorage(context)
val manager = SecureCredentialsManager(
context, account, storage, fragmentActivity,
localAuthenticationOptions
)
If you need more information, please refer to the examples.md file under the section Requiring Authentication.