build.gradle
to target Java 8 byte code for the Android and Kotlin plugins respectively.
build.gradle
dependencies file:
implementation 'com.auth0.android:lock:3.+'
You can check for the latest version on the repository Readme or in Maven.
After adding your Gradle dependency, remember to sync your project with Gradle files.
https://{yourDomain}/android/{yourAppPackageName}/callback
Replace {yourAppPackageName}
with your actual application’s package name, available in your app/build.gradle
file as the applicationId
value.
app/build.gradle
file add the Manifest Placeholders for the Auth0 Domain and the Auth0 Scheme properties, which are going to be used internally by the library to register an intent-filter that captures the authentication result.
strings.xml
file as string resources that can be referenced later from the code. This guide will follow that practice.
Auth0
with your application’s information. The easiest way to create it is by passing an Android Context. This will use the values previously defined in the strings.xml
file. For this to work, the string resources must be defined using the same keys as the ones listed above.
AuthenticationCallback
implementation that will handle user authentication events. The Credentials
object returned in successful authentication scenarios will contain the tokens that your application or API will end up consuming. See Tokens for more specifics.
onDestroy
method.
Lock
widget from inside your activity.
https
. This works best for Android Marshmallow (API 23) or newer if you’re using Android App Links, but in previous Android versions, this may show the intent chooser dialog prompting the user to chose either your application or the browser to resolve the intent. This is called the “disambiguation dialog”. You can change this behavior by using a custom unique scheme so that the OS opens the link directly with your app.
auth0Scheme
Manifest Placeholder value in the app/build.gradle
file or directly in the Intent Filter definition in the AndroidManifest.xml
file by changing the existing scheme to the new one.withScheme()
when configuring Lock with the builder, passing the scheme you want to use.AuthenticationException
you can check source to learn how to identify each error scenario.