Auth0.Android Configuration Options

Auth0.Android Configuration Options

Auth0.Android can be configured with a variety of options, listed below.

withConnection

The withConnection option lets you specify a connection that you want to authenticate with.

WebAuthProvider.login(account)
                .withConnection("twitter")
                .start(this, callback)

Was this helpful?

/

withScope

Using scopes can lets you return specific claims for specific fields in your request. Adding parameters to withScope lets you add more scopes. See Scopes for details.

WebAuthProvider.login(account)
                .withScope("openid profile email")
                .start(this, callback)

Was this helpful?

/

The default scope is openid profile email.

withConnectionScope

There may be times when you need to authenticate with particular connection scopes, or permissions, from the authentication provider in question. See Adding Scopes for an External IDP. However, if you need specific access for a particular situation in your app, you can do pass parameters to withConnectionScope. You can find a full list of the available parameters in that connection's settings on the Dashboard, or from the authentication providers's documentation. The scope requested here is added on top of the ones specified in the connection's settings in the Dashboard.

WebAuthProvider.login(account)
                .withConnectionScope("email", "profile", "calendar:read")
                .start(this, callback)

Was this helpful?

/

withParameters

To send additional parameters on the authentication, use withParameters.

val parameters = mapOf("param1" to "value1")

WebAuthProvider.login(account)
                .withParameters(parameters)
                .start(this, callback)

Was this helpful?

/

withHeaders

To send custom headers to the authorization endpoint, use withHeaders.

val headers = mapOf("header1" to "value1")

WebAuthProvider.login(account)
                .withHeaders(headers)
                .start(this, callback)

Was this helpful?

/

withScheme

If you are not using Android "App Links" or you want to use a different scheme for the redirect URI, use withScheme. Update the auth0Scheme Manifest Placeholder in the app/build.gradle file and the AllowList Allowed Callback URLs on the Dashboard in the Application's settings to match the chosen scheme.

WebAuthProvider.login(account)
                .withScheme("myapp")
                .start(this, callback)

Was this helpful?

/

withAudience

To provide an audience, use withAudience.

WebAuthProvider.login(account)
                .withAudience("https://YOUR_DOMAIN/userinfo")
                .start(this, callback)

Was this helpful?

/