mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
Fix indefinite hang on invalid PKCE client_id
This commit is contained in:
parent
5a8b55f5e8
commit
7e40a8e34b
@ -875,6 +875,27 @@ class SpotifyPKCE(SpotifyAuthBase):
|
||||
if self.code_verifier is None or self.code_challenge is None:
|
||||
self.get_pkce_handshake_parameters()
|
||||
|
||||
preflight_payload = {
|
||||
"client_id": self.client_id,
|
||||
"grant_type": "authorization_code",
|
||||
"code": "invalid_code",
|
||||
"redirect_uri": self.redirect_uri,
|
||||
"code_verifier": self.code_verifier,
|
||||
}
|
||||
|
||||
preflight_resp = self._session.post(
|
||||
self.OAUTH_TOKEN_URL,
|
||||
data=preflight_payload,
|
||||
headers={"Content-Type": "application/x-www-form-urlencoded"},
|
||||
timeout=self.requests_timeout,
|
||||
proxies=self.proxies
|
||||
)
|
||||
|
||||
if preflight_resp.status_code == 400:
|
||||
body = preflight_resp.json()
|
||||
if body.get("error") == "invalid_client":
|
||||
raise SpotifyOauthError("Invalid client_id")
|
||||
|
||||
payload = {
|
||||
"client_id": self.client_id,
|
||||
"grant_type": "authorization_code",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user