Skip to content

This is a simple example for using Spotipy with FastAPI with multi-user support.

License

Notifications You must be signed in to change notification settings

dieser-niko/spotipy-fastapi-oauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spotipy-fastapi-oauth

This is a simple example of using Spotipy with FastAPI with multi-user support.

Warning

I have no experience with FastAPI and this was pretty much the first time in two years that I've written anything with FastAPI.

Setup

  1. Clone the repository
  2. Install the requirements with pip install -r requirements.txt
  3. Configure config.toml.
  4. start the application with python -m uvicorn main:app --host 0.0.0.0 --port 15912 or similar.

Endpoints

Root (/)

Returns the user data (spotipy.Spotify.me()) if the user is logged in. If not, a 401 Unauthorised with the auth_url will be returned.

Callback (/callback)

After logging in with Spotify, the user should be redirected to this endpoint. If all goes well, the user will be redirected to root.

Logout (/logout)

Removes the session from the fake database (but not the cookies). Returns code 200 and {"detail": "success"} and the user must re-authenticate.

About

This is a simple example for using Spotipy with FastAPI with multi-user support.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages