google / google/adk-web

Set `user` when deploying a webUI

Open
#270 1 comment 3 reactions 1 assignee Claimed by @wyf7107 View on GitHub
Dominant language
TypeScript
Stars
1k
Forks
267
Avg merge
1d 12h
Merged PRs (30d)
9

Description

Currently whenever you deploy using either the `$adk` commands or using the `get_fast_api_app`, all users who test the application are all labeled as 'user' in the Session/Memory instances (with I believe the exception of deployments via Agent Engine).

I would love to see support for being able to set the current user. I've brainstormed a few ways this could be implemented using the FastAPI App:
- Implement a `get_user` function input to `get_fast_api_app()`
- Would be the simplest way - every time a new session is created or retrieved, this function would be called to get the current user.
- Allows for a wide variety of integrations depending on deployment scenarios
- Implement a callback url that sets the user in the browser session
- If I deploy this and put an OAuth screen in front of this, let me have the callback url go to `/api/user-callback` with a payload and it will set and use the user_id returned in the payload
- Integrate with Google Cloud IAP
- https://cloud.google.com/iap/docs/identity-howto
- Cloud Run IAP is in preview, but GKE IAP is not.
- Would be simple to check and would encourage people to deploy on GCP if authentication is simple

### Context
> Lastly, it would be nice if there was an easy way to set the `user` for a session. We're currently using IAP with a Cloud Run deployment. I'm thinking if we could pass a `get_user` function to the `get_fast_api_app` that could return the current user, then we can provide a way for the app to look up the current user ourselves. This would make it easier for many different deployment types to have a way to separate users.
>
> @dylan-apex great feedback. Do you mind creating a issue for us to track? Thanks.

_Originally posted by @hangfei in [#2133](https://github.com/google/adk-python/issues/2133#issuecomment-3138151579)_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.