Troubleshooting Google OAuth2 Authentication Issues in GPT: Repeated Sign-ins and 404 Errors

Hi,

Chatgpt helped me create the schema to add Google OAuth2 authentication to my GPT, but it doesn’t work in most cases.
When it does work, the authRequest action directs me to the google authentication page, I validate the authentication and then return to the GPT page successfully.
Then the next step asks me to authenticate again, and I get a 404 error.
From then on, when I reinitialize to connect again, I always get the 404 error. I’ll have to wait a long time for the first level to work again.

This is the schema :

{
  "openapi": "3.1.0",
  "info": {
    "title": "Google OAuth2 Authentication",
    "version": "1.0.0",
    "description": "API pour l'authentification des utilisateurs via Google OAuth2 et récupération de leur adresse e-mail."
  },
  "servers": [
    {
      "url": "https://www.googleapis.com",
      "description": "API Google OAuth2"
    }
  ],
  "paths": {
    "/oauth2/v2/auth": {
      "get": {
        "tags": ["Authentification"],
        "summary": "Demander une authentification utilisateur",
        "description": "Redirige l'utilisateur vers Google pour l'authentification.",
        "operationId": "authRequest",
        "parameters": [
          {
            "name": "client_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "redirect_uri",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "response_type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": ["code"]
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "default": "https://www.googleapis.com/auth/userinfo.email"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirection vers la page d'authentification Google."
          }
        }
      }
    },
    "/oauth2/v4/token": {
      "post": {
        "tags": ["Authentification"],
        "summary": "Échanger le code d'authentification contre un token",
        "description": "Obtient un token d'accès et un token de rafraîchissement en échangeant le code d'authentification.",
        "operationId": "exchangeCodeForToken",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "client_id": {
                    "type": "string"
                  },
                  "client_secret": {
                    "type": "string"
                  },
                  "redirect_uri": {
                    "type": "string"
                  },
                  "grant_type": {
                    "type": "string",
                    "enum": ["authorization_code"]
                  }
                },
                "required": ["code", "client_id", "client_secret", "redirect_uri", "grant_type"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Token d'accès et token de rafraîchissement obtenus avec succès.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "access_token": {
                      "type": "string"
                    },
                    "refresh_token": {
                      "type": "string"
                    },
                    "expires_in": {
                      "type": "integer"
                    },
                    "token_type": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/oauth2/v2/userinfo": {
      "get": {
        "tags": ["Utilisateur"],
        "summary": "Récupérer les informations de l'utilisateur",
        "description": "Utilise le token d'accès pour récupérer les informations de l'utilisateur, y compris son adresse e-mail.",
        "operationId": "getUserInfo",
        "parameters": [
          {
            "name": "access_token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Informations de l'utilisateur récupérées avec succès.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "email": {
                      "type": "string"
                    },
                    "verified_email": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}