@@ -67,6 +67,8 @@ def create_authorization_url(self, url, **kwargs):
6767 params = f"client_id={ self .client_id } &scope={ self .scope } "
6868 if kwargs .get ("audience" ):
6969 params += f"&audience={ kwargs .get ('audience' )} "
70+ if kwargs .get ("prompt" ):
71+ params += f"&prompt={ kwargs .get ('prompt' )} "
7072 return f"{ url } ?{ params } " , "mock_state"
7173
7274 def fetch_token (
@@ -251,6 +253,25 @@ def test_generate_auth_uri_with_audience_and_prompt(
251253 result = handler .generate_auth_uri ()
252254
253255 assert "audience=test_audience" in result .oauth2 .auth_uri
256+ assert "prompt=consent" in result .oauth2 .auth_uri
257+
258+ @patch ("google.adk.auth.auth_handler.OAuth2Session" , MockOAuth2Session )
259+ def test_generate_auth_uri_with_custom_prompt (
260+ self , openid_auth_scheme , oauth2_credentials
261+ ):
262+ """Test generating an auth URI with a custom prompt override."""
263+ oauth2_credentials .oauth2 .prompt = "none"
264+ exchanged = oauth2_credentials .model_copy (deep = True )
265+
266+ config = AuthConfig (
267+ auth_scheme = openid_auth_scheme ,
268+ raw_auth_credential = oauth2_credentials ,
269+ exchanged_auth_credential = exchanged ,
270+ )
271+ handler = AuthHandler (config )
272+ result = handler .generate_auth_uri ()
273+
274+ assert "prompt=none" in result .oauth2 .auth_uri
254275
255276 @patch ("google.adk.auth.auth_handler.OAuth2Session" , MockOAuth2Session )
256277 def test_generate_auth_uri_openid (
@@ -299,7 +320,7 @@ def test_generate_auth_uri_client_credentials_with_missing_scopes(
299320
300321 assert (
301322 result .oauth2 .auth_uri
302- == "https://example.com/oauth2/token?client_id=mock_client_id&scope="
323+ == "https://example.com/oauth2/token?client_id=mock_client_id&scope=&prompt=consent "
303324 )
304325 assert result .oauth2 .state == "mock_state"
305326
0 commit comments