In this tutorial, you will build a Python program to automate getting a users playlists from the Spotify API using OAuth.

We'll cover the API Reference, Authorization (Access Tokens, OAuth), Rate Limits. I will walk you through the parts of the API that let you retrieve songs, albums, playlists from the Spotify API.

I will explain OAuth 2.0 Authentication for REST APIs. We will go through the process of retrieving an access token and writing code to refresh that token from the Spotify API.

MY FAVOURITE PROGRAMMING BOOKS
Python Programming https://amzn.to/3TxsJx6
Python Programming 2 https://amzn.to/3IVa0GL
HTML/CSS https://amzn.to/3vrKBBs
Javascript and jQuery https://amzn.to/3TWiOmc
Java https://amzn.to/49dcJWN
Programming Interviews https://amzn.to/3TCr218
Programming Interviews 2 https://amzn.to/3VA6Dwp
Programming Interviews 3 https://amzn.to/49iGSUp

⌨️ MY DESK SETUP (I ACTUALLY USE) ⌨️
Keyboard 1 https://amzn.to/43Bizjx
Keyboard 2 https://amzn.to/4cABlLO
Keyboard 3 https://amzn.to/3Vy9aHm
Mouse https://amzn.to/4cwMxJy
Monitor https://amzn.to/3TxxczD

CREATOR SETUP
Camera Canon M50 https://amzn.to/3PDphQ8
Condenser Microphone https://amzn.to/3vvmMJ2
Condenser Audio Interface https://amzn.to/3Vvf1xe
Microphone Arm https://amzn.to/49cHACH
Video Light https://amzn.to/3PEUvGz

GET IN TOUCH:
Website: https://imdad.codes
Instagram: https://www.instagram.com/imdadcodes
TikTok: https://www.tiktok.com/@imdadcodes
Medium: https://medium.com/@imdadcodes

️ LIKE
It takes me a long time to make these videos, please give the video a thumbs up

WATCH NEXT
Programming Advice and Inspiration - https://www.youtube.com/playlist?list=PL1TBkFFBtagq7Z23M-joDArj24xGh4pa3
Python Projects - https://www.youtube.com/playlist?list=PL1TBkFFBtagpgD9zy1F6AzDswMzff99Tn
Learn Python with Exercises - https://www.youtube.com/playlist?list=PL1TBkFFBtagph84hW8-i9qSx27Wm7zrr9
Learn Programming Without Writing Code - https://www.youtube.com/playlist?list=PLC75BA6296374D8D4

SUBSCRIBE:
https://www.youtube.com/@imdadcodes?sub_confirmation=1

ℹ️ ABOUT THIS VIDEO:
In this video, we'll go over how you can get the currently playing track with the Spotify API. This was a requested video to build a Discord bot to get the currently playing song via the Spotify API. This Python tutorial will help you to build your applications with the Spotify API using React/Flutter/Javascript.

In later videos we will look at Spotify API Authorization flows such as OAuth and Access Tokens.

TIMESTAMPS:
00:00 What we're building
01:30 Navigating the Spotify Web API (Authorization, Scopes, Rate Limits)
01:26 Exploring the Spotify Web API Documentation
04:13 Spotify API Reference (Albums, Tracks, Artists, Playlists)
06:37 Spotify API (Console Demo)
07:40 Spotify API Authorization (Which OAuth 2.0 Flow?)
09:52 OAuth 2.0 Explained (The Only Explanation You'll Ever Need)
14:20 Setting up the Python Project (VSCode) & Installing Dependencies (Flask)
17:00 Creating an App on the Spotify API Developer Dashboard
18:30 Setting up the Flask Server & Flask Session
21:30 Getting the Client ID & Secret from the Spotify Developer Dashboard
22:04 Creating our first page
23:05 - Creating the endpoint for 'Login with Spotify'
28:37 - Creating the OAuth 2.0 Callback endpoint for Spotify API
39:03 - Using the Spotify OAuth 2.0 Access Token to Get User Playlists
43:35 - Refreshing the Spotify OAuth 2.0 Access Token (using refresh_token)
49:15 - Running our Flask app
51:18 - Testing our 'refresh token logic'
55:25 - Closing out (subscribe for more projects)
56:16 - Why I didn't use the Spotipy OAuth Spotify API Library

‍️ WHO AM I:
I'm Imdad, a startup founder and CTO in London, UK. I love making videos about life as a technical cofounder, teaching people to code through cool programming projects and productivity.

I even teach Python tutorials as it is a great programming language that's used by the likes of Google, Facebook, Twitter, Quora and pretty much every big tech company you can name.

#spotifyplaylist #spotifytutorial

Disclaimer: The links above are affiliate links. If you decide to purchase any of these products through my links, I'll receive a small commission at no extra cost to you. This helps support my channel, and I only recommend products that I've personally used and believe in.