---
title: "How to handle user, connector, and agent auth in Gemini Enterprise with a custom UI"
description: "Enterprises building a custom UI to embed Gemini Enterprise must handle three authentication flows that the built-in web app automates. For StreamAssist authentication, three patterns are available: Google Identity for Google Workspace users, Workforce Identity Federation for external IdP users, and Workload Identity Federation for backend bots. Federated Connectors require a two-phase 3LO flow where Customer BE checks the Keystore for tokens and triggers a consent popup when needed. Custom ADK agents use on-demand 3LO by wrapping protected sub-agent tools with GcpAuthProvider and deploying with Agent Identity. The guide provides runnable code for all three layers in a GitHub repository."
---

# How to handle user, connector, and agent auth in Gemini Enterprise with a custom UI

[Google](https://yomu.fyi/company/google) · Neeraj Agrawal · Nov 20, 2026

**Type:** Tutorial

## Summary

Enterprises building a custom UI to embed Gemini Enterprise must handle three authentication flows that the built-in web app automates. For StreamAssist authentication, three patterns are available: Google Identity for Google Workspace users, Workforce Identity Federation for external IdP users, and Workload Identity Federation for backend bots. Federated Connectors require a two-phase 3LO flow where Customer BE checks the Keystore for tokens and triggers a consent popup when needed. Custom ADK agents use on-demand 3LO by wrapping protected sub-agent tools with GcpAuthProvider and deploying with Agent Identity. The guide provides runnable code for all three layers in a GitHub repository.

## Context

Enterprises building a custom UI to embed Gemini Enterprise into an internal portal must handle three authentication flows that the built-in web app handles automatically: authenticating to StreamAssist, authenticating Federated Connectors, and handling per-tool OAuth for custom ADK agents.

## Approach / What changed

The guide provides three authentication patterns for StreamAssist (Google Identity, Workforce Identity Federation, Workload Identity Federation), a two-phase 3LO flow for Federated Connectors using the Keystore, and a four-phase on-demand 3LO flow for custom ADK agents using GCP Auth Manager Token Vault and Agent Identity.

## Takeaways

- For user-facing custom UIs, use Pattern 1A (Google Identity) or Pattern 1B (Workforce Identity Federation) to pass the signed-in employee’s identity and enforce per-user ACLs.
- Federated Connectors use 3-Legged OAuth (3LO) with Gemini Enterprise’s Keystore; Customer BE never stores third-party credentials, only triggers the consent popup when needed.
- Custom ADK agents avoid static OAuth by wrapping protected sub-agent tools with GcpAuthProvider and deploying with Agent Identity, enabling on-demand 3LO popups only when a protected tool is called.

## FAQ

### Which StreamAssist auth pattern should I use?

Use Pattern 1A (Pure Google Identity) when employees sign in with Google Workspace or Cloud Identity. Use Pattern 1B (Workforce Identity Federation) when employees sign in with an external IdP like Microsoft Entra ID or Okta. Use Pattern 1C (Workload Identity Federation) for non-personalized backend bots or shared service portals that do not need per-user ACLs.

### How does Federated Connector 3LO work in a custom UI?

Customer BE calls GE Server with the user's Bearer token to list connectors and check the Keystore. If no valid token exists, GE Server returns an authorization URL. Customer UI opens a 3LO popup, the user consents, and the callback saves the refresh token in the Keystore. Customer BE then includes the connector data stores in StreamAssist queries.

### How do I avoid blocking the entire agent for per-tool OAuth?

Wrap protected sub-agent tools with GcpAuthProvider backed by GCP Auth Manager's Token Vault, and deploy the agent with Agent Identity turned on. When a protected tool is called, StreamAssist triggers an on-demand 3LO popup only for that tool, rather than blocking the entire agent upfront with static OAuth configs.

**Tags:** [ADK](https://yomu.fyi/topic/adk), [Authentication](https://yomu.fyi/topic/authentication), [Gemini Enterprise](https://yomu.fyi/topic/gemini-enterprise), [Google Cloud](https://yomu.fyi/topic/gcp), [OAuth](https://yomu.fyi/topic/oauth)

- Source: [Google](https://developers.googleblog.com/how-to-handle-user-connector-and-agent-auth-in-gemini-enterprise-with-a-custom-ui)
- Source URL: https://developers.googleblog.com/how-to-handle-user-connector-and-agent-auth-in-gemini-enterprise-with-a-custom-ui
- Ingested by Yomu: 2026-11-20T21:00:27.046Z

[Read original post](https://developers.googleblog.com/how-to-handle-user-connector-and-agent-auth-in-gemini-enterprise-with-a-custom-ui)
