mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #905] SpotifyOAuth in bots #545
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#545
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 @Syzygianinfern0 on GitHub (Nov 30, 2022).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/905
I'm trying to use the add_tracks_to_playlist.py in a bot which needs to run periodically by itself.
When I run it locally with the right ID, Secret, Redirect URl, and Scope it opens the browser window where I can authenticate it and my code runs perfectly. When I tried to run it on my bot though it throws an error trying to open the webpage. How do I work around that? I tried putting the
.cachefile from my local run in the bot's filesystem but I think it expires after some time as it ran yesterday but not today.Here is the code snippet I used and the complete stack trace
@ShirinovAdil commented on GitHub (May 15, 2023):
@Syzygianinfern0 figured out a solution?
@dieser-niko commented on GitHub (May 15, 2023):
I don't think there is an elegant solution to this problem. I don't know if it's possible to have permanent access to an account, so the best solution is to create some sort of page that you would have to visit from time to time to re-authenticate.
Here's an example with flask: https://github.com/spotipy-dev/spotipy/blob/master/examples/app.py
@dieser-niko commented on GitHub (May 21, 2024):
Hi, just a quick follow up as I'm trying to resolve/close some old issues.
If you want to use headless auth, just follow this example: https://github.com/spotipy-dev/spotipy/blob/master/examples/headless.py
The previously suggested app.py example is still a valid solution if you prefer a webserver for authentication.
I'm going to close the issue for now, but feel free to re-open it if you have any questions.