user7830303
user7830303

Reputation:

Spotify - delete access token created with None value

I am trying to delete my Spotify access token generated with a None value, which broke at my second connection attempt.

I got this snippet from here --> github thread, used to clear the cached token:

import os
from json.decoder import JSONDecodeError

scope = <whatever_youwant>
try:
    token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
except (AttributeError, JSONDecodeError):
    os.remove(f".cache-{username}")
    token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)

but I get syntax error here:

os.remove(f".cache-{username}")

where is my token cached? how can I delete it as to regain access?

Upvotes: 1

Views: 768

Answers (1)

23k
23k

Reputation: 1399

The cache should be stored in a file at the root directory (where the python file gets executed).

It's named .cache-{username}. Make sure that you have hidden files turned on or else you probably won't see it.

Upvotes: 1

Related Questions