mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[PR #477] [MERGED] Fix issue with hanging authorization process if no port is provided (and updated docs) #911
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#911
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/spotipy-dev/spotipy/pull/477
Author: @jonascj
Created: 4/18/2020
Status: ✅ Merged
Merged: 4/19/2020
Merged by: @stephanebruckert
Base:
master← Head:localhost-port📝 Commits (3)
4bc2bfcFixed issue where using rediret uri 'localhost' (without specifying a port) would cause the authorization process to hang (not asking the user to paste/enter the URL redirected to)37e8e2cUpdated the documentation to match the changes to the authorization process - also kind of fixing issues #474 and #471be53659Fixed Flake8 over-indentation remark📊 Changes
3 files changed (+63 additions, -31 deletions)
View changed files
📝
docs/index.rst(+47 -24)📝
spotipy/oauth2.py(+14 -5)📝
spotipy/util.py(+2 -2)📄 Description
PR #243 added local http server to accept the auth redirect/callback, eliminating the need to copy and paste a URL during authorization (very cool, I love it).
But from my point of view, and issue #471 and #474 hints at the same thing, PR #243 broke applications / scripts which used redirect uri
http://localhost, causing them to hang during authorization (never asking for the URL to be pasted/entered in the console/terminal).Without this PR the fix is to change redirect uri to
http://localhost:8080(specify a non-privileged port). This PR changes the authorization process logic slightly such that a local host redirect uri with port specified (e.g.http://localhost:8080) will start the local http server, but a local host uri without port specified (e.g.http://localhost) will fallback to theEnter the URL you were redirected to:-method.With this PR old scripts/applications will continue to run and not hang unexpectedly.
The problem arises because the current Spotipy release starts a local http server (to listen for the redirect/callback) as soon as it detects a redirect uri containing
localhostor127.0.0.1. If no port is specified it defaults to port8080but since the request uri argument or envvar is stillhttp://localhostSpotify redirects tohttp://localhost:80/?code=...and nothttp://localhost:8080/?code=.... So the local server never receives any requests and hence continues to block execution of the script.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.