# AuthTabIntent.Builder

Artifact: [androidx.browser:browser](https://developer.android.com/jetpack/androidx/releases/browser) [View Source](https://cs.android.com/search?q=file:androidx/browser/auth/AuthTabIntent.java+class:androidx.browser.auth.AuthTabIntent.Builder) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

*** ** * ** ***


```
class AuthTabIntent.Builder
```

<br />

*** ** * ** ***

Builder class for `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent` objects.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder#Builder()()` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent` | `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder#build()()` Combines all the options that have been set and returns a new `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent` object. |
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder` | `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder#setCloseButtonIcon(android.graphics.Bitmap)(icon: https://developer.android.com/reference/android/graphics/Bitmap.html)` Sets the close button icon for the Auth Tab. |
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder` | `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder#setColorScheme(int)(colorScheme: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0, to = 2) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the color scheme that should be applied to the user interface in the Auth Tab. |
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder` | `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder#setColorSchemeParams(int,androidx.browser.auth.AuthTabColorSchemeParams)( colorScheme: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 1, to = 2) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, params: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabColorSchemeParams )` Sets `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabColorSchemeParams` for the given color scheme. |
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder` | `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder#setDefaultColorSchemeParams(androidx.browser.auth.AuthTabColorSchemeParams)(params: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabColorSchemeParams)` Sets the default `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabColorSchemeParams`. |
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder` | `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder#setEphemeralBrowsingEnabled(boolean)(enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether to enable ephemeral browsing within the Auth Tab. |
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder` | `@https://developer.android.com/reference/kotlin/androidx/browser/customtabs/ExperimentalPendingSession https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder#setPendingSession(androidx.browser.auth.AuthTabSession.PendingSession)(session: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession)` Associates the `https://developer.android.com/reference/android/content/Intent.html` with the given `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession`. |
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder` | `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder#setSession(androidx.browser.auth.AuthTabSession)(session: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession)` Associates the `https://developer.android.com/reference/android/content/Intent.html` with the given `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession`. |

## Public constructors

### Builder

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
Builder()
```

## Public functions

### build

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
fun build(): AuthTabIntent
```

Combines all the options that have been set and returns a new `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent` object.

### setCloseButtonIcon

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
fun setCloseButtonIcon(icon: Bitmap): AuthTabIntent.Builder
```

Sets the close button icon for the Auth Tab. A 24x24dp icon is recommended, though it may be scaled to fit the toolbar. The icon will be tinted according to the toolbar's color scheme; its original color is ignored, but the alpha channel is preserved.

| Parameters |
|---|---|
| `icon: https://developer.android.com/reference/android/graphics/Bitmap.html` | The icon `https://developer.android.com/reference/android/graphics/Bitmap.html`. |

### setColorScheme

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
fun setColorScheme(colorScheme: @IntRange(from = 0, to = 2) Int): AuthTabIntent.Builder
```

Sets the color scheme that should be applied to the user interface in the Auth Tab.

| Parameters |
|---|---|
| `colorScheme: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0, to = 2) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Desired color scheme. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsIntent#COLOR_SCHEME_SYSTEM()` |   |
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsIntent#COLOR_SCHEME_LIGHT()` |   |
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsIntent#COLOR_SCHEME_DARK()` |   |

### setColorSchemeParams

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
fun setColorSchemeParams(
    colorScheme: @IntRange(from = 1, to = 2) Int,
    params: AuthTabColorSchemeParams
): AuthTabIntent.Builder
```

Sets `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabColorSchemeParams` for the given color scheme. This allows specifying two different toolbar colors for light and dark schemes. It can be useful if `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsIntent#COLOR_SCHEME_SYSTEM()` is set: the Auth Tab will follow the system settings and apply the corresponding `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabColorSchemeParams` "on the fly" when the settings change. If there is no `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabColorSchemeParams` for the current scheme, or a particular field of it is null, the Auth Tab will fall back to the defaults provided via `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder#setDefaultColorSchemeParams(androidx.browser.auth.AuthTabColorSchemeParams)`. Example:

```kotlin
    AuthTabColorSchemeParams darkParams = new AuthTabColorSchemeParams.Builder()
            .setToolbarColor(darkColor)
            .build();
    AuthTabColorSchemeParams otherParams = new AuthTabColorSchemeParams.Builder()
            .setNavigationBarColor(otherColor)
            .build();
    AuthTabIntent intent = new AuthTabIntent.Builder()
            .setColorScheme(COLOR_SCHEME_SYSTEM)
            .setColorSchemeParams(COLOR_SCHEME_DARK, darkParams)
            .setDefaultColorSchemeParams(otherParams)
            .build();

    // Setting colors independently of color scheme
    AuthTabColorSchemeParams params = new AuthTabColorSchemeParams.Builder()
            .setToolbarColor(color)
            .setNavigationBarColor(color)
            .build();
    AuthTabIntent intent = new AuthTabIntent.Builder()
            .setDefaultColorSchemeParams(params)
            .build();
```

| Parameters |
|---|---|
| `colorScheme: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 1, to = 2) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | A constant representing a color scheme (see `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder#setColorScheme(int)`). It should not be COLOR_SCHEME_SYSTEM, because that represents a behavior rather than a particular color scheme. |
| `params: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabColorSchemeParams` | An instance of `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabColorSchemeParams`. |

### setDefaultColorSchemeParams

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
fun setDefaultColorSchemeParams(params: AuthTabColorSchemeParams): AuthTabIntent.Builder
```

Sets the default `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabColorSchemeParams`. This will set a default color scheme that applies when no `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabColorSchemeParams` specified for current color scheme via `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder#setColorSchemeParams(int,androidx.browser.auth.AuthTabColorSchemeParams)`.

| Parameters |
|---|---|
| `params: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabColorSchemeParams` | An instance of `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabColorSchemeParams`. |

### setEphemeralBrowsingEnabled

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
fun setEphemeralBrowsingEnabled(enabled: Boolean): AuthTabIntent.Builder
```

Sets whether to enable ephemeral browsing within the Auth Tab. If ephemeral browsing is enabled, and the browser supports it, the Auth Tab does not share cookies or other data with the browser that handles the auth session.

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether ephemeral browsing is enabled. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsIntent#EXTRA_ENABLE_EPHEMERAL_BROWSING()` |   |

### setPendingSession

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
@ExperimentalPendingSession
fun setPendingSession(session: AuthTabSession.PendingSession): AuthTabIntent.Builder
```

Associates the `https://developer.android.com/reference/android/content/Intent.html` with the given `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession`. Overrides the effect of `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent.Builder#setSession(androidx.browser.auth.AuthTabSession)`.

| Parameters |
|---|---|
| `session: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession` | The `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession` to associate the intent with. |

### setSession

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
fun setSession(session: AuthTabSession): AuthTabIntent.Builder
```

Associates the `https://developer.android.com/reference/android/content/Intent.html` with the given `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession`. Guarantees that the `https://developer.android.com/reference/android/content/Intent.html` will be sent to the same component as the one the session is associated with.

| Parameters |
|---|---|
| `session: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession` | The `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession` to associate the intent with. |