Pyscript with Spotipy authentication help

Hi all, I’m trying to use my working python script and convert it into a fully functioning app using PyScript. Currently I’m having an issue with the authentication step for Spotify. When I run the Python script locally, it opens a browser window and prompts the user for Spotify login info, then redirects to a different url, which the user has to copy-paste back into the terminal window. When I run the script in PyScript, it opens the browser window with the Spotify login but also errors out at the same time with EOFError: EOF when reading a line.

I think it’s clear that something is getting out of sync with the authentication. It doesn’t give a chance for the user to paste the redirect url. But really I’m not sure. I’ve also tried using asynchronous functions with await but no luck. I’m fairly new to PyScript and full stack programming in general so any idea as to what is causing the issue is helpful! Keep in mind that this script does work locally when I convert it to an exe. I’m just trying to get it working in the console for PyScript to start.

Here is the chunk of code with the authentication:

scope = "user-library-read user-library-modify playlist-modify-public"
    auth = SpotifyOAuth(
    sp = spotipy.Spotify(auth_manager=auth)
    results = sp.current_user_playlists()

Maybe someone could help me gain an understanding of the differences in execution between
a PyScript webpage versus a local executable? Thank you.

I’m not sure how to delete this post, but I realized that I’m using the wrong form of authorization. I’m trying to figure out how to use PKCE authorization now.