Search code examples
curloauthgoogle-apioauth-2.0google-oauth

Google OAuth: Invalid_client the oauth client was not found


I'm reposting because the other cases where this issue was reported have not solved my problem. Right now I'm just trying to get a refresh_token that can later be used in a gcp cloud function to call the directory API. However the following curl command fails:

$ curl -d "my_client_id&scope=https://www.googleapis.com/auth/admin.directory.user" https://accounts.google.com/o/oauth2/device/code

With the following error:

{
  "error" : "invalid_client",
  "error_description" : "The OAuth client was not found."
}

Things I have tried:

  • Made sure my OAuth Client ID is "other" and not web application.
  • Changed the product name under consent screen to see if it can find the client ID
  • Reset the client secret
  • Renamed the Oauth Client Name
  • Waited an hour
  • Opened a ticket with Google under our G Suite contract (where they said they don't support their own APIs haha).

Anyone here have any good ideas?


Solution

  • Turns out there was a typo in my client id from using the up arrow (command history) on mac which wasn't visible until pressing enter and reviewing the command after execution.

    Also found out that this scope (admin.directory) cannot be used with https://accounts.google.com/o/oauth2/device/code since devices are considered insecure, so only a limited set of scopes are allowed.