mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #834] Is there any way to use Github Actions Python testing while using Authorization Code Flow? #512
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#512
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 @MarijnStam on GitHub (Jun 26, 2022).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/834
Hello all,
I have recently tried to set up Github Actions to automatically perform my tests with pytest whenever a push happens.
A lot of these tests revolve around interacting with spotipy and use the Authorization Code Flow.
For this I use the redirect URI:
http://localhost:8080to handle the URL prompt for authentication. Locally, this works fine and all tests work. However in the GitHub Action, the test using spotipy will hang indefinitely. I verified that the enviroment variables are properly set for the automatic tests.I assume I can't handle the URL prompt the same way as I do it locally, as I can't just open a webserver on the Github Actions container (I think?).
Is there any workaround for this? I would like to have my tests automatically ran on a push.
Thanks!
@harshvardhaniimi commented on GitHub (Aug 24, 2023):
I am running into this issue as well. I am not creating a public app, just for my own usecase. But it seems to run into this problem where Github Actions will crash after trying it for six hours.
@MarijnStam commented on GitHub (Aug 25, 2023):
Thank you for reporting that you run into the same issue. I have not found a solution yet for this issue since reporting, although I have not put much time into it.
@harshvardhaniimi commented on GitHub (Aug 25, 2023):
Yesterday, I was able to execute my code with Github Actions, thanks to help from ChatGPT. Essentially, the function
refresh_access_tokenobtains a new access token from Spotify using a refresh token. Inside the function,client_idandclient_secretare concatenated and base64 encoded to create the authorization header, and aPOSTrequest is made to Spotify's token endpoint with a payload containing the refresh token. The function returns the new access token, which is then used to authenticate a Spotipy client instance. This allows me to use it without reauthenticating via browser. Works like a charm!@MarijnStam commented on GitHub (Aug 29, 2023):
Thanks a bunch for this update! I'll be sure to get back to this when I pick up this project again.