mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #662] Can a cache file be made in a Heroku environment? Authorization trouble in Django app #396
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#396
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 @xxristoskk on GitHub (Apr 2, 2021).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/662
So I'm trying to deploy an app that would have multiple users authorize their Spotify accounts, but I'm running into an issue with authorization. I have a button for users to authorize their account after giving their username, and everything seems to work with two exceptions: 1) the authorize URL doesn't bring the user to the authorize page, and 2) the tokens that are returned, and saved to the user's profile, are associated with my Spotify account. I thought maybe it was a cache issue, but i have ".cache" in my .gitignore file, so I have no idea how this is happening. Here is my code.
views.py:
html template:
At first I initialized
oauthas a global variable without the username, but thought this way would solve the problem, and it didn't. Is it possible for Spotipy to create a cache file within the Heroku environment that I'm not seeing in my GitHub repo?I'd really like to keep Spotipy for this project since I already had the scripts for finding the music already made.
@stephanebruckert commented on GitHub (Apr 2, 2021):
Here is how to make spotipy work in an API https://github.com/plamere/spotipy/blob/master/FAQ.md#how-to-use-spotipy-in-an-api
@xxristoskk commented on GitHub (Apr 2, 2021):
Thanks @stephanebruckert! I didn't see the FAQ before and it was a bit helpful, but I'm having a hard time wrapping my head around the logic of creating a custom cache handler. I made a class, and it is getting me as far as the Spotify authorization page, but I'm getting a NotImplementedError when being redirected. Here is the class I made.
This error is very new to me and so is dealing with subclasses, so thank you in advance for your time and patience!
Edit:
Oops, I see now that those methods need to be renamed to match CacheHandler. I think it works now.
@xxristoskk commented on GitHub (Apr 5, 2021):
This custom cache handler definitely works in production, now that I changed the method names.