Google oauth inside of google AI studio

Hello, I am building an app inside Google Ai Studio that requires using Google’s OAuth.

The problem is that I can’t authenticate because this is a contained environment.

I am not sure if its doable to autenticate, but I dont know the actual redirect URL that should be added inside my google cloud project.

Is there any workaround for this? I want to be able to develop the app straight inside Google AI studio without having to keep downloading and running it locally for the authentication to work so I could see the changes I made.

1 Like

Yeah ran into this today - really limits the apps I can prototype inside ai studio.

After deploying your app to Google Cloud Run using the deploy button, does opening the link to the deployed app and then authentication using Google Oauth work well?

Hi @Affiliate_Power , Thanks for reaching out to us!

Google OAuth requires stable, secure redirect URIs that you own or that you have been authorized to use. Since you’re using Google AI Studio’s contained environment, it may not provide a publicly accessible endpoint needed for OAuth.

One workaround is to deploy the app to a stable HTTPS endpoint( such as Cloud Run ), which can be registered as the OAuth redirect URI. This process will satisfy the OAuth policies, allowing OAuth authentication to work.

2 Likes

Hi @Sonali_Kumari1, thanks for the info. I really tougtht I was messing something up for some painfull hours…

Would you know if enabling this is on the product roadmap? It’s really necessary, since once you deploy the app, the Code Assistant can’t identify errors and review the specifc code.

I noticed that other providers supply a stable URI that can be configured in the OAuth and Google AI Studio almost quite does that, since everytime the page is refreshed or you log out, the URI changes… But that’s not a big problem…

Isn’t it possible to make the same (not so stable) URI identified as secure by Google since it’s issue by it? Then we would at least be able the test in the preview frame for a limited time

As you mentioned, after deploying the app oath is working. Now I am in trouble with keeping refresh tokens open 24/7 for my agent created throught no code agent builder.

We are working on making it easier to build apps that use Google Auth directly in AI Studio.