Google Sheets Plugin : Error 400, redirect_uri_mismatch

I whipped up a Flask app that allows interaction with the Google Sheets API. I registered an OAuth client ID, and the JSON metadata file gets verified on the ChatGPT site when I try to install. However, when I click “Log into google” as prompted by the ChatGPT site to log in to the Google Sheets API, I receive an Error 400 with the message “redirect_uri_mismatch”.

The error URL is:
accounts google com /signin/oauth/error/v2?authError=%3D%3D&client_id=

In my manifest file, I am initiating the OAuth flow with:

"auth": {  
"type": "oauth",
"client_url": "accounts google com  /o/oauth2/auth", 
"client_id":"client_id_here",
"client_secret":"client_secret_here",
"redirect_uris": [      
chat openai com  /aip/plugin-<pluginid>/oauth/callback       
],       
"scope": "www googleapis com  /auth/spreadsheets",  
"authorization_url": "oauth2 googleapis com   /token",       
"authorization_content_type": "application/json",
"verification_tokens": {    
"openai": "token"  
}

The REDIRECT_URI is:
chat openai com /aip/plugin-/oauth/callback

This is the approved redirect URI I have configured on the Google Developer Console for my OAuth client ID.

Curious why am I receiving the redirect_uri_mismatch error when the redirect URI in my code matches what is configured on Google’s side.

I appreciate any help in troubleshooting!

Thank you,
Alex

Same issue, did you find a solution? It seems like the redirect URI is unique every time I grant access within the gpt…

1 Like

I am having all sorts of redirect_uri mismatch issues.

  1. the redirect_uri needs to be one controlled and monitored by OpenAI
  2. as such we GPT builders are using the generated one provided in the GPT Builder UI
  3. but yes, it regenerates to something different every time any config is changed in the OAS spec or various other places ; so you are constantly going to Google, Azure or wherever the source API is waiting and changing OAuth2 configs there and waiting for web caches to all sync (10 - 30 min for me)

I think the developer needs more control over this GPT Builder redirect_uri regeneration process. After the first time, why not give the developer full control over any more regenerations?

2 Likes

OMG !! I went totally crazy yesterday trying to make this work, and i kept thinking something was wrong with the way i had configured it, i did a stupid hack, i wrapped the redirec_uri with my own, which accept chatgpts uri and redirects to it

1 Like

How do you handle the changed openai URL when updated through your own URL? Did you use a regex?

I just maintain the changing urls in state object , so i know where to redirect to in this particular login attempt