Requirements changes
v2 requires Android API version 21 or later and Java 8+. Here’s what you need inbuild.gradle to target Java 8 byte code for Android and Kotlin plugins respectively:
Open ID Connect only
v2 only supports OIDC-Conformant applications. When using this SDK to authenticate users, only the current Auth0 authentication pipeline and endpoints will be used. We removed thesetOIDCConformant(boolean value) method from the Auth0 class.
Learn more about the OpenID Connect Protocol.
Authorization Code with PKCE
v2 only supports the Authorization Code with Proof Key for Code Exchange (PKCE) flow. We removed thewithResponseType(@ResponseType int type) method on WebAuthProvider.Builder.
Removal of WebView support
We removed the deprecated ability to authenticate using aWebView component. External browser applications will always be used instead for increased security and user trust.
Removal of legacy authentication API support
We removed methods and classes specific to calling any authentication APIs categorized as Legacy. See the complete list in the Classes and interfaces removed section below.Request interfaces changes
Thecom.auth0.android.request package defines the top-level interfaces for building and executing HTTP requests. Historically, a common issue has been the inability to add custom headers and request parameters to all request types. We’ve refactored the request interfaces to enable any request to be customized with additional headers and request parameters. Note that these parameters now need to be of type String.
The top-level Request interface now specifies these methods:
public fun addParameters(parameters: Map<String, String>): Request<T, U>public fun addParameter(name: String, value: String): Request<T, U>public fun addHeader(name: String, value: String): Request<T, U>
ParameterizableRequestAuthRequest
AuthenticationAPIClient contains many changes to the return type of methods as a result. These are some examples:
-
Any methods that returned
ParameterizableRequest,TokenRequest, orDatabaseConnectionRequest, now return aRequest -
Any method that returned
AuthRequestnow returnsAuthenticationRequest
start or execute to make the request, no changes are required.
The AuthenticationRequest interface no longer has a setAccessToken("{ACCESS-TOKEN}") method. This method was for setting the token to the request made to the /oauth/access_token Authentication API legacy endpoint, disabled as of June 2017. If you need to send a parameter with this name, please use addParameter("access_token", "{ACCESS-TOKEN}").
Any classes that implemented ParameterizableRequest or AuthRequest have been updated to accommodate these changes.
See the complete list in the Classes and interfaces removed section below.
Networking client customization
v2 improves the ability to customize the way this library makes HTTP requests. A new interface,NetworkingClient, defines the contract for executing HTTP requests. You can configure Auth0 class with an instance of NetworkingClient. This lets you provide your own implementation for complete control over the networking client. Additionally, the default networking client provided by this library supports several sample customization points to enable easy configuration of common customization points.
Timeout configuration
Logging configuration
Detailed change listing
Files that changed their package
- We moved the
com.auth0.android.authentication.request.ProfileRequestclass tocom.auth0.android.request.ProfileRequest. - We moved the
com.auth0.android.authentication.request.SignUpRequestclass tocom.auth0.android.request.SignUpRequest.
Internal package
The previous version of this library exposed a few classes in thecom.auth0.android.request.internal package. These were never meant to be part of the library’s Public API; Java documentation discouraged their direct use. Since the codebase had migrated to Kotlin, we now take advantage of the internal modifier and use it where necessary. These classes might appear as public classes for Java projects, but do not use them. They are still not part of this library’s Public API.
We will not provide support for these classes. We will change these as required without notice.
Classes and interfaces removed
- The
com.auth0.android.util.Base64class has been removed. Useandroid.util.Base64instead. - The
com.auth0.android.request.ParameterizableRequestinterface has been removed. We moved the ability to add request headers and parameters to thecom.auth0.android.request.Requestinterface. - The
com.auth0.android.request.AuthRequestinterface has been removed. Use thecom.auth0.android.request.AuthenticationRequestinterface instead. - The
com.auth0.android.provider.WebAuthActivityclass has been removed. External browser applications will always be used for authentication. - The
com.auth0.android.result.Delegationclass has been removed. This was used as the result of the request to the Authentication API legacy endpoint, disabled as of June 2017. - The
com.auth0.android.authentication.request.DelegationRequestclass has been removed. This was used to represent the request to the legacy Authentication API endpoint, disabled as of June 2017. - The
com.auth0.android.util.Telemetryclass has been renamed tocom.auth0.android.util.Auth0UserAgent. - The
com.auth0.android.request.AuthorizableRequestclass has been removed. You can achieve the same result usingaddHeader("Authorization", "Bearer {TOKEN_VALUE}"). - The
com.auth0.android.authentication.request.TokenRequestclass has been removed. We moved the ability to set a Code Verifier and any request headers and parameters to thecom.auth0.android.request.Requestinterface. - The
com.auth0.android.authentication.request.DatabaseConnectionRequestclass has been removed. We moved the ability to set any request headers and parameters to thecom.auth0.android.request.Requestinterface. - The
com.auth0.android.provider.VoidCallbackclass has been removed. We replaced the ability to use a callback that doesn’t take an argument withCallback<Void, AuthenticationException>. - The
com.auth0.android.request.ErrorBuilderinterface has been removed. - The
com.auth0.android.RequestBodyBuildExceptionclass has been removed. - The
com.auth0.android.util.CheckHelperclass has been removed. - The
com.auth0.android.util.JsonRequiredinterface has been removed. - The
com.auth0.android.util.JsonRequiredTypeAdapterFactoryclass has been removed.
Constants removed
ParameterBuilder.GRANT_TYPE_JWThas been removed.ParameterBuilder.ID_TOKEN_KEYhas been removed.ParameterBuilder.DEVICE_KEYhas been removed.ParameterBuilder.ACCESS_TOKEN_KEYhas been removed.ResponseType.CODE,ResponseType.ID_TOKEN, andResponseType.ACCESS_TOKENhave been removed.
Classes and Interfaces changed
SignupRequestnow implementsAuthenticationRequestinstead of the now-removedAuthRequestAuthorizableRequestnow extendsRequestinstead of the now-removedParameterizableRequestBaseCallbackhas been deprecated; useCallbackinstead.
Constructors changed
- You can no longer construct
AuthenticationAPIClientfrom aContext. UseAuthenticationAPIClient(auth0: Auth0)instead. You can create an instance ofAuth0using aContext. - You can no longer construct
UsersAPIClientfrom aContext. UseUsersAPIClient(auth0: Auth0, token: String)instead. You can create an instance ofAuth0using aContext. SignupRequestnow requires the second parameter to be anAuthenticationRequest.ProfileRequestnow requires anAuthenticationRequestand aRequest<UserProfile, AuthenticationException>.- You can no longer construct
Credentialswith an “expires in” value. Give the date of expiration or “expires at” instead. You typically won’t constructCredentialson your own.
Methods removed or changed
Auth0 methods removed
setOIDCConformant(boolean enabled)andisOIDCConformant()have been removed. The SDK now only supports OIDC-Conformant applications.doNotSendTelemetry()has been removed. There is no replacement.setWriteTimeoutInSeconds(seconds)andgetWriteTimeoutInSeconds(seconds)have been removed. There is no replacement.setReadTimeoutInSeconds(seconds)andgetReadTimeoutInSeconds(seconds)have been removed. You can customize the read timeout directly on theDefaultClientclass. UseDefaultClient(readTimeout = 123).setConnectTimeoutInSeconds(seconds)andgetConnectTimeoutInSeconds(seconds)have been removed. You can customize the connect timeout directly on theDefaultClientclass. UseDefaultClient(connectTimeout = 123).setLoggingEnabled(boolean enabled)andisLoggingEnabled()have been removed. You can enable the network traffic logger directly on theDefaultClientclass. UseDefaultClient(enableLogging = true). Use it for debugging purposes and never enable it on production environments.setTLS12Enforced()andisTLS12Enforced()have been removed. The SDK now supports modern TLS by default.
AuthenticationAPIClient methods removed or changed
setUserAgent(String)has been removed. You can set headers to be sent directly on each Request instance using theaddHeader("{NAME}", "{VALUE}")method or globally to the networking client instance viaDefaultClient(defaultHeaders = mapOf())constructor parameter.
delegation(),delegationWithIdToken("{ID-TOKEN}"),delegationWithRefreshToken("{REFRESH-TOKEN}"), anddelegationWithIdToken("{ID-TOKEN}", "{API-TYPE}}"). Support for Legacy Authentication API endpoints have been removed.loginWithOAuthAccessToken("{TOKEN}", {CONNECTION}). For selected social providers, you can useloginWithNativeSocialToken("{TOKEN}", "{TOKEN-TYPE}")instead.tokenInfo("{ID-TOKEN}"). UseuserInfo("{ACCESS-TOKEN}")instead.
ParameterizableRequest now return a Request:
userInfo("{ACCESS-TOKEN}")revokeToken("{REFRESH-TOKEN}")renewAuth("{REFRESH-TOKEN}")passwordlessWithEmail("{EMAIL}", PasswordlessType, "{CONNECTION}")passwordlessWithSMS("{PHONE-NUNBER}", PasswordlessType, "{CONNECTION}")fetchJsonWebKeys()
AuthRequest now return an AuthenticationRequest:
login("{USERNAME-OR-EMAIL}", "{PASSWORD}", "{REALM-OR-CONNECTION}")login("{USERNAME-OR-EMAIL}", "{PASSWORD}")loginWithOTP("{MFA-TOKEN}", "{OTP}")loginWithNativeSocialToken("{TOKEN}", "{TOKEN-TYPE}")loginWithPhoneNumber("{PHONE-NUMBER}", "{VERIFICATION-CODE}", "{REALM-OR-CONNECTION}")loginWithEmail("{EMAIL}", "{VERIFICATION-CODE}", "{REALM-OR-CONNECTION}")
DatabaseConnectionRequest now return a Request:
createUser("{EMAIL}", "{PASSWORD}", "{USERNAME}", "{CONNECTION}")resetPassword("{EMAIL}","{CONNECTION}")
TokenRequest now return a Request:
token("{AUTHORIZATION-CODE}", "{CODE-VERIFIER}", "{REDIRECT-URI}")
AuthenticationRequest methods removed
addAuthenticationParameters(parameters)has been removed. UseaddParameters(parameters)instead.setDevice("{DEVICE}").UseaddParameter("device", "{VALUE}")instead.
WebAuthProvider.Builder methods removed
useCodeGrant(boolean useCodeGrant). There is no replacement; only Code + PKCE flow supported in v2.useBrowser(boolean useBrowser). There is no replacement; this library no longer supports WebView authentication.useFullscreen(boolean useFullscreen). There is no replacement; this library no longer supports WebView authentication.withResponseType(@ResponseType int type). There is no replacement; only Code + PKCE flow are supported in v2.start(activity: Activity, callback: AuthCallback, requestCode: Int)has been removed. Usestart(activity: Activity, callback: Callback<Credentials, AuthenticationException>)instead.
WebAuthProvider.LogoutBuilder methods removed
start(context: Context, callback: VoidCallback). Usestart(context: Context, callback: Callback<Void, AuthenticationException>)instead.
WebAuthProvider methods removed
init(account: Auth0)has been removed. Uselogin(account: Auth0)instead.init(context: Context)has been removed. Uselogin(account: Auth0)instead.resume(requestCode: Int, resultCode: Int, intent: Intent)has been removed. Useresume(intent: Intent)instead.init(account: Auth0)has been removed. Uselogin(account: Auth0)instead.
ParameterBuilder methods removed
setDevice("{DEVICE}")has been removed. Useset("device", "{VALUE}")instead.
UsersAPIClient methods changed
setUserAgent(String)has been removed. You can set headers to be sent directly on each Request instance using theaddHeader("{NAME}", "{VALUE}")method or globally to the networking client instance viaDefaultClient(defaultHeaders = mapOf())constructor parameter.
ParameterizableRequest now return a Request:
link("{PRIMARY-USER-ID}", "{SECONDARY-TOKEN}")unlink("{PRIMARY-USER-ID}", "{SECONDARY-USER-ID}", "{SECONDARY-PROVIDER}")updateMetadata("{USER-ID}", userMetadata)getProfile("{USER-ID}")
RequestFactory methods removed or changed
TheRequestFactory class contains methods to facilitate making HTTP requests, including the serialization and deserialization of the JSON request body and response. As part of the com.auth0.android.request.internal package, it is not intended for public use, but as a public type, the summary of changes is described below.
- All request methods have been refactored to be decoupled from a specific HTTP request library (for example,
OkHttp) - All request methods now return a
Request. - All request methods are now lowercase (for example,
POST()->post()). - The
authenticationPOSTmethod was removed without a replacement, as allRequestinstances can be parameterized with any headers as needed.
ProfileRequest methods changed
- The
addParametersmethod now requires the value to be Map of String to String, instead of String to Object (addParameters(mapOf("key" to "val")))
SignUpRequest methods changed
Methods that set parameters now require the value to be a Map of String to String, instead of String to Object:addAuthenticationParameters(mapOf("key" to "val"))addSignupParameters(mapOf("key" to "val"))addParameters(mapOf("key" to "val"))
setDevice("device") was removed. Use addParameter("device", "{VALUE}") instead.