feat: 🚧 Starting working on spotify auth + create QR code for easy sharing

This commit is contained in:
2024-07-01 00:42:46 +02:00
parent 708c8beac6
commit 9a1e02c90a
4 changed files with 51 additions and 12 deletions

View File

@ -1,7 +1,8 @@
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
from spotipy.oauth2 import SpotifyClientCredentials, SpotifyOAuth
import os
from dotenv import load_dotenv
from flask import url_for
load_dotenv()
@ -25,11 +26,14 @@ def createPlaylist(playlistName):
#TODO: Implement this function
pass
def spotifyLogin():
def create_spotify_oauth():
"""
This function is used to login to spotify to get the user token
:return: user token
This function creates a Spotify OAuth object
:return: SpotifyOAuth object
"""
credentials = spotipy.oauth2.SpotifyClientCredentials(client_id=os.getenv("client_id"), client_secret=os.getenv("client_secret"))
spotify_token = credentials.get_access_token()
return spotify_token
return SpotifyOAuth(
client_id=os.getenv("client_id"),
client_secret=os.getenv("client_secret"),
redirect_uri=url_for('callback', _external=True),
scope='playlist-modify-public'
)