mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #1073] Headless auth? #631
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#631
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 @dougthor42 on GitHub (Feb 20, 2024).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1073
Is your feature request related to a problem? Please describe.
I run this using a headless host / one without access to a web browser (eg: I'm SSH'd into a different machine).
Describe the solution you'd like
When authenticating using the Authorization Code Flow, print the auth url in the terminal. This allows the user to copy it into a browser manually. Then wait for the user to paste the secret into the terminal.
Describe alternatives you've considered
For now I just have to copy my code to a non-headless (headfull?) machine and run it from there.
Additional context
Headless auth was also mentioned in the 3.0 ideas issue https://github.com/spotipy-dev/spotipy/issues/652#issuecomment-894581817
@aymather commented on GitHub (Mar 5, 2024):
@dougthor42 instead of doing a workaround just for the authentication flow in your headless environment, perform the auth flow once locally (i.e. in an environment where you can get redirected to a browser) which will create a
.cachefile for you. Then just move that file to your headless environment (i.e. the place you're ssh'ed into) and it should work without needing to authenticate every time because it can pull the token data from your.cachefile.@twointum commented on GitHub (Mar 12, 2024):
Hi! Where exactly does that .cache file go? I have the same issue and it's driving me crazy. My remote server is running a python virtual environment that is running Apache Airflow.
@dougthor42 commented on GitHub (Mar 12, 2024):
Looks like the same dir as the file being run. For example, in https://github.com/dougthor42/spotify-favorites-fixer:
The file itself has this pattern:
@dieser-niko commented on GitHub (Apr 30, 2024):
Hi there, sorry for the late reply. Most auth managers in spotipy have an
open_browserparameter, you can use it like this: spotipy/examples/headless.py@dieser-niko commented on GitHub (May 21, 2024):
Closing as this issue seems to be resolved.