When OAuth refresh_token expires chatgpt doesnt ask for new authentication

Hi everyone,
im making an authenticated GPT, im using oauth authentication with refresh_token.
Everything is working as expected until the refresh_token expires, at that point i return :

res.status(400).json({ error: ‘invalid_grant’, error_description: ‘Refresh token expired, please re-authenticate’ });

which should be compliant with RFC 6749 that oauth2 uses.

At this point it creates a loop in which chat gpt sends a grant_type: ‘refresh_token’ and my endpoint respond with the above.

i dont understand what should i do instead.

What i expect is that chat gpt, at the point i send status 400, sends a new authorization_code for a new autentication from the user.

Thank you in advance for anyone who can help!