Error: deleted_client The OAuth client was deleted
Asked Answered
C

6

5

How can you delete an old clientID?

I have created and generated a new clientID in the google developer console

google developer console

the new clientID does not match the one in the browser. This probably explains the error while attempting to signin

error while attempting to signin

I know everything is right in the app set up

  • this is my package.json

    "name": "auth-firebase-2", "version": "0.0.1", "author": "Ionic Framework", "homepage": "http://ionicframework.com/", "private": true, "scripts": { "clean": "ionic-app-scripts clean", "build": "ionic-app-scripts build", "lint": "ionic-app-scripts lint", "ionic:build": "ionic-app-scripts build", "ionic:serve": "ionic-app-scripts serve" }, "dependencies": { "@angular/animations": "5.2.9", "@angular/common": "5.2.9", "@angular/compiler": "5.2.9", "@angular/compiler-cli": "5.2.9", "@angular/core": "5.2.9", "@angular/forms": "5.2.9", "@angular/http": "5.2.9", "@angular/platform-browser": "5.2.9", "@angular/platform-browser-dynamic": "5.2.9", "@ionic-native/core": "4.6.0", "@ionic-native/splash-screen": "4.6.0", "@ionic-native/status-bar": "4.6.0", "@ionic/storage": "2.1.3", "angularfire2": "^5.0.0-rc.6.0", "cordova-android": "7.0.0", "cordova-browser": "5.0.3", "cordova-ios": "4.5.4", "cordova-plugin-device": "^2.0.2", "cordova-plugin-googleplus": "^5.3.0", "cordova-plugin-ionic-keyboard": "^2.0.5", "cordova-plugin-ionic-webview": "^1.2.0", "cordova-plugin-splashscreen": "^5.0.2", "cordova-plugin-whitelist": "^1.3.3", "firebase": "^4.13.0", "ionic-angular": "3.9.2", "ionicons": "3.0.0", "rxjs": "5.5.8", "sw-toolbox": "3.6.0", "zone.js": "0.8.26" }, "devDependencies": { "@ionic/app-scripts": "3.1.9", "typescript": "~2.6.2" }, "description": "An Ionic project", "cordova": { "plugins": { "cordova-plugin-whitelist": {}, "cordova-plugin-device": {}, "cordova-plugin-splashscreen": {}, "cordova-plugin-ionic-webview": {}, "cordova-plugin-ionic-keyboard": {}, "cordova-plugin-googleplus": { "WEB_APPLICATION_CLIENT_ID": "1043269342338-6fta7jjp2u2rf4fhiupme8b0g1bf3br4.apps.googleusercontent.com", "REVERSED_CLIENT_ID": "com.googleusercontent.apps.558165536676-14360cssjil4t4c6tcvnr9ugu8lanehc" } }, "platforms": [ "browser", "android" ] } }

  • Google Sign in is enabled

enter image description here

  • I have created the credentials in the google developper console and GooglePlus API is enabled as well

The only issue is that the browser seems to retain the old clientID (now deleted)

I have tried as follows : - clear caching in chrome : settings > advanced > clear browsing data - npm cache clean

nothing worked. So How do you actually remove all references to an old clientID ?

Thanks

Camellia answered 20/4, 2018 at 18:26 Comment(1)
Do not publish your credentials.Lonesome
L
4

Not sure if you're still looking for an answer but posting it here for anyone else.

This happens because you deleted the credentials on the Google Developer Console. Once you go back in there and recreate credentials, head back to your working directory and delete your old token which should be there.

It'll be back up and running after.

Lauro answered 20/2, 2019 at 19:13 Comment(2)
Can you provide more detail on how to delete the old token in the local working directory?Isolda
There should be a token.pickle file where you're running from Python script from. That's how the code should be executing. Run 'pwd' to check for your current working directory, you should find the file there. Delete and it will reauthenticate for you and create a new token.Lauro
V
2

1)go to your account 2)restore your project (only admin can restore project and time limit is within 30 day's) 3)some of the service is not started so go to api and services -> OAuth consent screen edit app next and finish

Vraisemblance answered 21/9, 2021 at 11:11 Comment(0)
S
1

When you create the new credentials delete the old token file which resides in your project directory.

Sulphone answered 28/2, 2019 at 20:21 Comment(0)
S
0

I got the same error after deleting a project and creating a new one, creating a new credential and when trying to connect to the google sheet api.

Restoring the old projects didn't solve the problem, but I found that the client_id and client_secret credentials of the old project are stored and gspread queries them even after creating new project and credentials the program continued using them.

Run this code to find the exact path of the file that stores the old credentials:

> def get_config_dir(config_dir_name="gspread", os_is_windows=os.name ==
> "nt"):
>         r"""Construct a config dir path.
>     
>         By default:
>             * `%APPDATA%\gspread` on Windows
>             * `~/.config/gspread` everywhere else
>     
>         """
>         if os_is_windows:
>             return os.path.join(os.environ["APPDATA"], config_dir_name)
>         else:
>             return os.path.join(os.path.expanduser("~"), ".config", config_dir_name)
>     
>     DEFAULT_CONFIG_DIR = get_config_dir()
>     
>     DEFAULT_AUTHORIZED_USER_FILENAME = os.path.join(
>         DEFAULT_CONFIG_DIR, "authorized_user.json"
>     )
>     
>     print(DEFAULT_AUTHORIZED_USER_FILENAME)

Inside this code change the two credentials to the current project.

Notice that when you try to run your code again, it will return that the token is incorrect.

So to adjust the token, cut from this folder (just remove) and run your code to do a new authentication.

Hope this helps.

Shayshaya answered 3/6, 2022 at 4:15 Comment(0)
D
0

I recently faced the same issue. If you see the google sheets API docswhich gspread uses underneath, you can see the following code:

    if not creds or not creds.valid:
        if creds and creds.expired and creds.refresh_token:
            creds.refresh(Request())
        else:
            flow = InstalledAppFlow.from_client_secrets_file(
                'credentials.json', SCOPES)
            creds = flow.run_local_server(port=0)
        # Save the credentials for the next run
        with open('token.json', 'w') as token:
            token.write(creds.to_json())

As you can see here that a "token.json" is created in here which is the actual credentials. The credentials file that you downloaded from the google cloud console is not actual file used to access the API.

Here in this gspread functions the second argument is probably that "token.json" file which is actually saved at ~/.config/gspread/(on mac) and %APPDATA%\gspread( on windows). Source: https://docs.gspread.org/en/latest/oauth2.html

gc = gspread.oauth(
    credentials_filename='path/to/the/credentials.json',
    authorized_user_filename='path/to/the/authorized_user.json'
)

So delete the file from ~/.config/gspread/

Detach answered 7/6, 2022 at 11:32 Comment(0)
W
0

I got this error while setting up Calibre Web. I deleted the OAuth Client, created a new one but it was trying to use the old OAuth client ID and secret. I figured out there was a .yaml file stored in the .calibre-web folder which had the old client details saved. I edited the YAML file and that fixed it.

Wharton answered 13/2 at 14:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.