Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

OAuth 2.0 does not detect restored OAuth Clients

Hello, 

We accidentally deleted and then re-created a project, which also forced us to re-create our deleted OAuth clients. 

However, our app login now fails with the following error, even though the client is restored and the IDs and secrets match: 

The OAuth client was deleted.
If you are a developer of this app, see error details.
Error 401: deleted_client

I've seen other users with the same issues, but answers were inconclusive. Can't open an account ticket either, since I don't have an org.
0 1 108
1 REPLY 1

Hi @ejoebstl,

Welcome to Google Cloud Community!

The 401: deleted_client error happens due to the  deletion of OAuth clients when a project is deleted. Even if you set up the client using the identical credentials, it is regarded as a new entity, and there’s a chance that all prior authorizations are forfeited.

You may resolve this by:

  1. Checking if the deleted OAuth clients were soft-deleted (somehow) - Still examine if there’s (in any way) that your old clients can be retrieved by navigating to the Deleted Credentials page. 
  2. Updating Your Application with the New OAuth Credentials – Ensure the new Client ID and Secret are properly configured in your app.
  3. Re Authenticating Users – Ask users to log in again and grant access, as previous tokens are no longer valid.
  4. Verifying OAuth Consent Screen Settings – Ensure the consent screen is set up correctly in the Google Cloud Console.
  5. Enabling Required APIs – Confirm that all necessary APIs are enabled in API & Services.
  6. Checking Logs for Errors – Use Cloud Logging to diagnose further issues.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

Top Labels in this Space