mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #814] Authentication works locally but not on server #506
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#506
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?
Originally created by @Mardiff on GitHub (May 30, 2022).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/814
Describe the bug
I've managed to get authentication working locally with caches. Essentially, I have an HTML form that calls the following line on submit:
sp = spotipy.Spotify( auth_manager=spotipy.SpotifyOAuth(username=spotify_username, scope=ALL_SCOPES, cache_path=f"./caches/{spotify_username}"))This works fine when running my Flask app locally with Flask run, with my redirect URI set to http://localhost:8080/. However, with the same code, I am unable to get it working on a web server (speciflcally gunicorn inside a Heroku job).
With my redirect URI set to anything that doesn't contain a port, I get an EOF error since Spotipy is waiting for user input. That's fine. But when I include a port, like in http://localhost:8080/, the server lags for a while and then throws a [CRITICAL] WORKER TIMEOUT. Is it because I'm using gunicorn? Is that a known issue? Why else would this fail on a Heroku server when it works fine on my local server?
@Peter-Schorn commented on GitHub (Jun 11, 2022):
You need to change your redirect URI to a URL on your server. You can't use
http://localhost:8080/(with any port number).See https://github.com/plamere/spotipy/blob/master/examples/app.py
@Mardiff commented on GitHub (Jun 15, 2022):
My goal was to have other users authenticate on their own, but that doesn't seem to be possible, right?
From what I can tell, localhost and 127.0.0.1 can only be used running the servers locally (which makes sense), so if I were to use another URL, it goes to interactive authentication, which requires input to the terminal, which I don't have because Heroku is a non-interactive terminal.
It appears I'm at a standstill. Perhaps this is now a feature request, then - either a way to perform non-interactive authentication for other users to use, or a way for interactive authentication to not require terminal input.
@itsa-mee-mario commented on GitHub (Jun 29, 2022):
any updates? im trying the same
@stephanebruckert commented on GitHub (Jun 29, 2022):
@itsa-mee-mario, @Mardiff, you have a full example here that lets multiple users authenticate via a non-local webserver https://github.com/plamere/spotipy/blob/master/examples/app.py
@itsa-mee-mario commented on GitHub (Jun 29, 2022):
@stephanebruckert hi, I seem to be having a problem similar to @Mardiff
im getting this in the logs
i want the user to log into spotify, thatd need this url to be opened on the client side, is there any way to do that?
@stephanebruckert commented on GitHub (Jun 29, 2022):
Your
SPOTIPY_REDIRECT_URIwould need to be changed tohttp://example.comboth in "code" and in the spotify app settings, have you tried that?@itsa-mee-mario commented on GitHub (Jun 29, 2022):
getting another error saying
@itsa-mee-mario commented on GitHub (Jun 29, 2022):
yes have done that, put the same application uri as a redirect uri