# 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)

*** ** * ** ***


```
public final class AuthTabIntent.Builder
```

<br />

*** ** * ** ***

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

## Summary

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

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

## Public constructors

### Builder

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

```
public Builder()
```

## Public methods

### build

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

```
public @NonNull AuthTabIntent build()
```

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

### setCloseButtonIcon

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

```
public @NonNull AuthTabIntent.Builder setCloseButtonIcon(@NonNull Bitmap icon)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Bitmap.html icon` | 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)

```
public @NonNull AuthTabIntent.Builder setColorScheme(@IntRange(from = 0, to = 2) int colorScheme)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0, to = 2) int colorScheme` | Desired color scheme. |

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

### setColorSchemeParams

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

```
public @NonNull AuthTabIntent.Builder setColorSchemeParams(
    @IntRange(from = 1, to = 2) int colorScheme,
    @NonNull AuthTabColorSchemeParams params
)
```

Sets `https://developer.android.com/reference/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/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/androidx/browser/auth/AuthTabColorSchemeParams` "on the fly" when the settings change. If there is no `https://developer.android.com/reference/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/androidx/browser/auth/AuthTabIntent.Builder#setDefaultColorSchemeParams(androidx.browser.auth.AuthTabColorSchemeParams)`. Example:

```
    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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1, to = 2) int colorScheme` | A constant representing a color scheme (see `https://developer.android.com/reference/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. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/auth/AuthTabColorSchemeParams params` | An instance of `https://developer.android.com/reference/androidx/browser/auth/AuthTabColorSchemeParams`. |

### setDefaultColorSchemeParams

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

```
public @NonNull AuthTabIntent.Builder setDefaultColorSchemeParams(@NonNull AuthTabColorSchemeParams params)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/auth/AuthTabColorSchemeParams params` | An instance of `https://developer.android.com/reference/androidx/browser/auth/AuthTabColorSchemeParams`. |

### setEphemeralBrowsingEnabled

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

```
public @NonNull AuthTabIntent.Builder setEphemeralBrowsingEnabled(boolean enabled)
```

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 |
|---|---|
| `boolean enabled` | Whether ephemeral browsing is enabled. |

| See also |
|---|---|
| `https://developer.android.com/reference/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
public @NonNull AuthTabIntent.Builder setPendingSession(@NonNull AuthTabSession.PendingSession session)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/auth/AuthTabSession.PendingSession session` | The `https://developer.android.com/reference/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)

```
public @NonNull AuthTabIntent.Builder setSession(@NonNull AuthTabSession session)
```

Associates the `https://developer.android.com/reference/android/content/Intent.html` with the given `https://developer.android.com/reference/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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/auth/AuthTabSession session` | The `https://developer.android.com/reference/androidx/browser/auth/AuthTabSession` to associate the intent with. |