How To Use The Spotify API In Your React JS App

  Рет қаралды 37,125

Dom the dev

Dom the dev

Күн бұрын

In this video you will learn how to use the Spotify API in your React JS Application to authenticate with your Spotify Account and to fetch data from the Spotify API.
Enjoy this video and if like what you see please hit the Like and the Subscribe button.
I am happy for every feedback I get, so i can improve my content.
If you have any suggestions feel free to drop a comment.
0:00 - Intro
0:05 - Create Spotify App
1:15 - Create React App
1:46 - Authenticate with Spotify
11:36 - Fetch Data from Spotify
15:50 - Fix local storage issue
18:11 - Render Data in Frontend
_____________________________________________________________
Ressources
GitHub Files: github.com/dom-the-dev/spotif...
Spotify Developer Dashboard: developer.spotify.com/
_____________________________________________________________
Follow me on Twitter: / dom_thedev
Subscribe at my Channel: / @domthedeveloper
______________________________________________________________
Support:
Buy me a coffee: ko-fi.com/domthedev
PayPal: paypal.me/domiderdude

Пікірлер: 58
@michaelchan6144
@michaelchan6144 2 жыл бұрын
Thanks for the great video. Is there an easier way to get the access token from hash? Does Spotify really expect us to feed the hash into such a function just to get the access token.
@Domthedeveloper
@Domthedeveloper 2 жыл бұрын
Hi Michael, thank you, glad you liked the video. And I am glad you asked, since I am using now a different approach. You can use URLSearchParams like that: let urlParams = new URLSearchParams(window.location.hash.replace("#","?")); let token = urlParams.get('access_token'); I hope this is a bit clearer and easier to use.
@michaelchan6144
@michaelchan6144 2 жыл бұрын
@@Domthedeveloper Will try this tmr. THANK YOU SO MUCH!!
@Domthedeveloper
@Domthedeveloper 2 жыл бұрын
@@michaelchan6144 You are welcome!
@jefmitchell7868
@jefmitchell7868 2 жыл бұрын
@@Domthedeveloper Can you give the example of doing this? Typescript is screaming about if (!token && hash) { token = hash.substring(1).split("&").find(elem => elem.startsWith("access_token")).split("=")[1] window.location.hash = "" window.localStorage.setItem("token", token) } being undefined. I try const getToken = () => { let urlParams = new URLSearchParams(window.location.hash.replace("#","?")); let token = urlParams.get('access_token'); } useEffect(() => { getToken(); setToken(token); }, []); and it never redirects. Thanks for the awesome tutorial and thanks in advance for the help.
@Domthedeveloper
@Domthedeveloper 2 жыл бұрын
@@jefmitchell7868 Hey Jeff, not easy to find the problem here.. have you compared yours with mine? Check this file (the second appraoch is commented out) : github.com/dom-the-dev/spotify-with-react/blob/main/src/App.js
@Aly-uv1pk
@Aly-uv1pk 2 жыл бұрын
Thanks for this! Working on a project in Vue using this API, and your video was the only one that actually demonstrated clearly how to properly consume the API.
@ammuubisht
@ammuubisht Жыл бұрын
You made this seem wayy easier, Kudos man!👏👏
@riantopera
@riantopera Жыл бұрын
Thank you man! I was struggling a lot with this API, helped a lot!
@annageisenberger3433
@annageisenberger3433 2 жыл бұрын
Very well explained!
@MyJoao321
@MyJoao321 Жыл бұрын
Just what I was looking for, thanks Dom!
@Domthedeveloper
@Domthedeveloper Жыл бұрын
Glad to help!
@AbhishekSingh-mh2fg
@AbhishekSingh-mh2fg Жыл бұрын
smoothest explanation Dom.
@samyrrakoto3784
@samyrrakoto3784 Жыл бұрын
Thanks for this, actually helped me out :) ! cheers
@nimapourmohammadi4854
@nimapourmohammadi4854 Жыл бұрын
Very useful and I learned so much thank you
@shahinazizi4782
@shahinazizi4782 10 ай бұрын
dude you are awesome! hope you keep on the great work! and also hope you will use next js in ur next videos! much more efficient! lots of love 🌹
@ohlordjohnsonxx150
@ohlordjohnsonxx150 2 жыл бұрын
That’s really helpful 👍🏻👌🏻
@Domthedeveloper
@Domthedeveloper 2 жыл бұрын
Glad to hear that
@ArepaZombie
@ArepaZombie Жыл бұрын
Thanks for this great video!! I was looking for something like this. Just an advice... make your code font bigger, so we can see it easily
@Tony-me3cu
@Tony-me3cu 2 жыл бұрын
Awesome Vid, thanks!
@Domthedeveloper
@Domthedeveloper 2 жыл бұрын
Thanks Tony!
@paras5197
@paras5197 2 жыл бұрын
awesome video thanks so much
@ligaming3325
@ligaming3325 5 ай бұрын
this helps a lot thanks bro
@ibelachichinedu9716
@ibelachichinedu9716 Жыл бұрын
Thanks Dom
@vitaliykaminskiy4583
@vitaliykaminskiy4583 2 жыл бұрын
Wow very impressive
@mathiasburg242
@mathiasburg242 2 жыл бұрын
Nice work Bro.
@Domthedeveloper
@Domthedeveloper 2 жыл бұрын
Thank you!
@smellingyou
@smellingyou Жыл бұрын
Ty bro
@dinarfairussalsabillah1696
@dinarfairussalsabillah1696 2 жыл бұрын
thank you so much 😍
@Domthedeveloper
@Domthedeveloper 2 жыл бұрын
You are welcome 🙏
@sasc7107
@sasc7107 2 жыл бұрын
Mega !
@angelangelov3225
@angelangelov3225 Жыл бұрын
Hello, if I want to add a player that streams my own playlists on my website, is this approach secure? I mean, it would be really easy for someone to get the Client ID and secret from Chrom Devtools if they inspect the request, right?
@user-mr3hl9ix3s
@user-mr3hl9ix3s 9 ай бұрын
thanks, broo
@stalan7404
@stalan7404 2 жыл бұрын
I want to make a game with Spotify's album cover images, in React. is your tutorial okay with this? thank you
@orlandoleija9382
@orlandoleija9382 Жыл бұрын
Hi Dom, nice video, thanks for the info. What is the name of that extension that marks things for you? like effect, initialState, separator, key, etc.. seems useful
@sirdalus
@sirdalus 9 ай бұрын
i'd love to know as well
@aadargupta
@aadargupta 2 жыл бұрын
I'm having some issues - I get an error saying too many re-renders
@lanijey6481
@lanijey6481 Жыл бұрын
can you upload how to make a playlist of the Spotify where user can listen to it
@himike3278
@himike3278 2 жыл бұрын
Great video! How does the refresh token work with a post request? Thanks!
@Domthedeveloper
@Domthedeveloper 2 жыл бұрын
Can you maybe describe a bit more what you need to do?
@legoghetto2689
@legoghetto2689 2 жыл бұрын
Thank you so much for the video, but is it possible to do the same without token? So there will be no authorization required. Would I still be able to make these requests etc.?
@Domthedeveloper
@Domthedeveloper 2 жыл бұрын
No, you need a token to verify your account
@victoranyadiegwu7999
@victoranyadiegwu7999 Жыл бұрын
Can I do this but without the submit button?
@Ant-yq5ze
@Ant-yq5ze 2 жыл бұрын
dude pls use better theme next time, also larger font, it helps
@alicek9660
@alicek9660 8 ай бұрын
if i were to make a website that asks user rto enter their spotify username to fetch their data whill that still require an access token ?
@JM-hf9bl
@JM-hf9bl 4 ай бұрын
Have you found an aswer?
@DiamondBack502
@DiamondBack502 2 жыл бұрын
baba gemacht bruder
@Domthedeveloper
@Domthedeveloper 2 жыл бұрын
Danke spicy!!
@andreyclown6389
@andreyclown6389 Жыл бұрын
How I can add scopes? Because as soon as I tried to create a playlist, the token received in this way no longer matches. I need to add scopes, but I can't figure out how to do it correctly.
@ModernCombatLP1909
@ModernCombatLP1909 Жыл бұрын
you can simply add "&scope=scope1,scope2,..." to the href url
@T3Kiwi
@T3Kiwi Жыл бұрын
I keep getting CORS error, any fix for this?
@kaystrings
@kaystrings Жыл бұрын
me too have you been able to fix this?
@messerefrankfurter
@messerefrankfurter Жыл бұрын
don't work, I'm still receive a message "been blocked by cors policy
@kaystrings
@kaystrings Жыл бұрын
me too have you been able to fix this?
@MoltenCreeper
@MoltenCreeper Жыл бұрын
Does anybody know why adding more to the REDIRECT_URI like "/spotify" at the end (for a separate page) causes an error for "Invalid redirect URI"? I even added the new "/spotify" route to developer.spotify website under the Redirect URI section.
Building a Spotify API Searcher in React
37:56
Cooper Codes
Рет қаралды 42 М.
She ruined my dominos! 😭 Cool train tool helps me #gadget
00:40
Go Gizmo!
Рет қаралды 54 МЛН
Haha😂 Power💪 #trending #funny #viral #shorts
00:18
Reaction Station TV
Рет қаралды 8 МЛН
ОДИН ДЕНЬ ИЗ ДЕТСТВА❤️ #shorts
00:59
BATEK_OFFICIAL
Рет қаралды 3 МЛН
Best frontend and backend projects for resume
13:11
Hitesh Choudhary
Рет қаралды 160 М.
How To Build A Better Spotify With React
58:17
Web Dev Simplified
Рет қаралды 330 М.
Why I avoid useEffect For API Calls and use React Query instead
17:45
How To Use The Spotify API In A React JS Application
26:59
Scottish Coder
Рет қаралды 11 М.
I built a chat app in 7 minutes with React & Firebase
8:53
Fireship
Рет қаралды 1,3 МЛН
React Native Login with JWT Auth Context
24:59
Simon Grimm
Рет қаралды 49 М.
Купил этот ваш VR.
37:21
Ремонтяш
Рет қаралды 274 М.
Как работает автопилот на Lixiang L9 Max
0:34
Семен Ефимов
Рет қаралды 17 М.
#miniphone
0:16
Miniphone
Рет қаралды 3,3 МЛН
WWDC 2024 - June 10 | Apple
1:43:37
Apple
Рет қаралды 10 МЛН