Spotify API - How to get an OAuth Access Token (API Review Series)

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ต.ค. 2024

ความคิดเห็น • 70

  • @Api-university
    @Api-university  4 ปีที่แล้ว

    Download the node.js source code developed in the video: api-university.com/blog/spotify-api-how-to-get-an-oauth-access-token-api-review-series/

  • @vincentarlou1599
    @vincentarlou1599 5 ปีที่แล้ว +21

    Actually, that's a really good content right here; Instead of giving a lecture and demonstrating a code that just works, this guy figures out how to make an idea work by thinking through the problem, but I agree about the music. It's better without it since you explain a lot and there's no time to get bored, nor in any sense, it's a step by step tutorial. I had to think through the problem as well. I really liked the Spotify series, they have really cool API, maybe do one more video exploring the features of it

  • @brockobama257
    @brockobama257 3 ปีที่แล้ว

    This video made me realize that if I open the app I built using the API in an incognito window I will be prompted to login. I watched this video to learn how to allow other users to sign into their accounts using my app. I did not even consider that my browser was automatically logging me in. So thank you!

  • @Sillymonkeies
    @Sillymonkeies ปีที่แล้ว +1

    Thank you very much! This helped me a lot

  • @albertomengual4953
    @albertomengual4953 ปีที่แล้ว +1

    8:33 url encoder
    11:36 Authorization Basic encoding

  • @eduardob.muller8778
    @eduardob.muller8778 5 ปีที่แล้ว +2

    Very clarifying tutorial! Hope to see more! Thanks for posting the video without the music, with a speed of 2.0 the music gets so weird haha

  • @joemulhern
    @joemulhern 4 ปีที่แล้ว +1

    Thank you so much for this information. You allowed me to make a RFID jukebox using the spotify API!

    • @Api-university
      @Api-university  4 ปีที่แล้ว

      Fantastic!
      Do you have a video on your project?

  • @madelinestevens4184
    @madelinestevens4184 5 ปีที่แล้ว +14

    Great tutorial! I just wish I could see your screen better. It's difficult to see details in the code even when I zoom in. Thanks again for a great tutorial! Still working on mine. I keep getting an invalid redirect URI even after double checking it is correct everywhere (even after encoding to base 64).

  • @danielarodriguez1967
    @danielarodriguez1967 4 ปีที่แล้ว +2

    This is a great video sir, really helped that you are showing all the errors. Thanks!

    • @Api-university
      @Api-university  4 ปีที่แล้ว +1

      Glad it helped! Check out the other tutorial videos as well: th-cam.com/play/PL19JOifaOyAeifscOYwXJbkUGkeV2he4O.html

  • @gustavomonte6672
    @gustavomonte6672 3 ปีที่แล้ว

    Very helpful! Much appreciated.

  • @thehinduobserver9803
    @thehinduobserver9803 3 ปีที่แล้ว +1

    Liked and subscribed, thank you for what you do.

  • @93simongh
    @93simongh 5 ปีที่แล้ว +82

    I'd rather see a bigger screen than your face for half an hour

    • @eshaxcx
      @eshaxcx 4 ปีที่แล้ว +7

      Unnecesarily rude

    • @cosmosnomad
      @cosmosnomad 4 ปีที่แล้ว +15

      @@eshaxcx Necessarily rude

  • @mati124
    @mati124 3 ปีที่แล้ว

    this is haaaard

  • @mr_gryphon
    @mr_gryphon 5 ปีที่แล้ว +1

    Hopefully there’s more on the way from this channel

    • @Api-university
      @Api-university  5 ปีที่แล้ว +2

      Thanks Mario, more coming soon. Anything particular you are interested in?

    • @mr_gryphon
      @mr_gryphon 5 ปีที่แล้ว

      API-University I’ve been interested in the Zillow API as there are not many videos on TH-cam currently. New subscriber of the channel and wanted to let you know your Spotify videos really helped me on a hobby project recently.

  • @XPedro75
    @XPedro75 2 ปีที่แล้ว

    Hi, it is possible to have a new link about the source code?

  • @ismayilismayilov4229
    @ismayilismayilov4229 2 ปีที่แล้ว

    Hi sir, first of all, thank you for the great content! However, when I try to send a request with accessToken, it throws an error with 401 status code saying "Invalid access token". I cannot solve this issue and can't go any further. If you could help, I'd appreciate it!

  • @James-eo1pk
    @James-eo1pk 3 ปีที่แล้ว +1

    Where are you typing the client id and client secret into? what page is that?

    • @Api-university
      @Api-university  3 ปีที่แล้ว

      that is an app, that calls the token endpoint. I build it using nodejs

    • @James-eo1pk
      @James-eo1pk 3 ปีที่แล้ว

      @@Api-university ok thanks!

  • @danielarodriguez1967
    @danielarodriguez1967 4 ปีที่แล้ว +1

    Really helpful!

  • @anondolphin4982
    @anondolphin4982 3 ปีที่แล้ว

    What do we enter as redirect uri? It wasn't very clear to me in the document hence I was confused. Sorry if my question comes across as stupid, Ido not know much about making api calls, but I'm trying to learn. Thank you.

    • @Api-university
      @Api-university  3 ปีที่แล้ว +1

      Redirect uri is the address where you want the OAuth auth code to be sent. It is an endpoint (URL) on your application.

    • @anondolphin4982
      @anondolphin4982 3 ปีที่แล้ว

      @@Api-university thank you so much! :) I understood and I was finally able to get through the "Invalid redirect URI" error. Also great video! fairly straight-forward and was a great help to me. I'm looking forward to learn more and more about APIs.

  • @junky3445
    @junky3445 3 ปีที่แล้ว

    This tutorial is great but the only problem that have is that for some reason my encoded url isn't working in the browser i'm getting an invalid redirect message. Any thoughts? Is it because I can't just use any website to redirect to?

    • @Api-university
      @Api-university  3 ปีที่แล้ว

      Yes. The URL you use as redirecturl parameter needs to match the URL you registered as redirect endpoint on spotify.

    • @junky3445
      @junky3445 3 ปีที่แล้ว

      @@Api-university Thank you so much that was one part of the video that I mistakenly skipped over. Just now I have an issue with the playlists.items href call saying it can't read property 0.I'll try to figure it out anyways awesome video!!!

  • @rosstv_
    @rosstv_ 2 ปีที่แล้ว

    how do i bring up the terminal commands up?

  • @mistyblunch
    @mistyblunch 3 ปีที่แล้ว

    Thanks, it works fine! :D

  • @XPedro75
    @XPedro75 3 ปีที่แล้ว

    Hi, Ican't find the source code

  • @lukegardner949
    @lukegardner949 5 ปีที่แล้ว

    Is there a way to dynamically pull the code from the redirect uri without a manual copy and paste? I would like to have an application that allows me to modify playlists, but right now I have to copy and paste the code from the redirect uri in the browser every time (major limitation).

    • @GooseGumlizzard
      @GooseGumlizzard 4 ปีที่แล้ว

      Yes you can , Spotify github actually provides a function to get the hashed params from the auth token in the URI.
      getHashParams() {
      return window.location.hash
      .substring(1)
      .split('&')
      .reduce(function(initial, item) {
      if (item) {
      var parts = item.split('=');
      initial[parts[0]] = decodeURIComponent(parts[1]);
      }
      return initial;
      }, {});
      }
      just make sure you set the response_type in the auth request url to 'token', i had it set to 'code' per the official docs and that wouldn't work.

    • @pabloalfaro2595
      @pabloalfaro2595 3 ปีที่แล้ว

      @@GooseGumlizzard is there a way to do this without node.js ? IE pulling from curl?

    • @Api-university
      @Api-university  3 ปีที่แล้ว

      @@pabloalfaro2595 YES. I have a series of tutorials on this, on the example of the LinkedIn APIs. Wors the same way for Spotify or any other OAuth2 Provider: th-cam.com/video/WhKkbpMjSks/w-d-xo.html&ab_channel=API-University

    • @Api-university
      @Api-university  3 ปีที่แล้ว

      Yes. I have a series of tutorials on this, on the example of the LinkedIn APIs. Wors the same way for Spotify or any other OAuth2 Provide. Check out: th-cam.com/video/WhKkbpMjSks/w-d-xo.html&ab_channel=API-University

  • @koeniedoenie
    @koeniedoenie 4 ปีที่แล้ว +5

    Do you have a tutorial on getting a new access token with a refresh token?

    • @Api-university
      @Api-university  4 ปีที่แล้ว +1

      Yes, I describe it in detail how you can refresh your OAuth access tokens with a refresh token here: api-university.com/courses/oauth-2-0-course/

    • @repcsi
      @repcsi 3 ปีที่แล้ว

      It's the same thing as you get the bearer token, but you must include your refresh_token, and then the API will send you a new access_token. Sometimes the API may send you over a new refresh_token as well (at least that's what the doc says). This even works before the expiration of the token that you got already (lifetime is 3600 seconds which equals 1 hour)

  • @simonostini5731
    @simonostini5731 4 ปีที่แล้ว +1

    Is it possible to request a Token that never expires?

    • @Api-university
      @Api-university  4 ปีที่แล้ว

      You cannot get a single token that never expires. But: You can create a system, that always makes a valid token available. The key is the so-called refresh-token of OAuth. You need to use it in a background process, that continuously refreshes the token, before the access token expires. I describe how this is done in this course: api-university.com/courses/oauth-2-0-course/

    • @simonostini5731
      @simonostini5731 4 ปีที่แล้ว

      @@Api-university oh nice thanks for the answer. That's what I thought yeah. In that's case I'll watch the video :)

  • @AfroBearGaming
    @AfroBearGaming 3 ปีที่แล้ว

    i get -bash -d command not found error everytime

  • @yifeigao3193
    @yifeigao3193 5 ปีที่แล้ว

    How did you get the description for the website? Like the Clined ID required something

    • @Api-university
      @Api-university  5 ปีที่แล้ว +1

      You have to read up on OAuth. get my OAuth Cheatsheet on api-university.com/newsletter

  • @mdakmalhossain7592
    @mdakmalhossain7592 5 ปีที่แล้ว +3

    how can we rid from expire token ?

    • @Api-university
      @Api-university  5 ปีที่แล้ว +1

      If the access_token expires, and you have a valid refresh_token, you can use the refresh_token to get a new access_token without involving the resource owner.

    • @Api-university
      @Api-university  5 ปีที่แล้ว

      You have to read up on OAuth. get my OAuth Cheatsheet on api-university.com/newsletter

  • @christhomasism
    @christhomasism 5 ปีที่แล้ว +6

    bro good video but less of your head and more of the screen

  • @AslamD
    @AslamD 4 ปีที่แล้ว +1

    Subscribed :)

  • @zeeshanqamar9442
    @zeeshanqamar9442 4 ปีที่แล้ว

    need source code anybody have it

    • @Api-university
      @Api-university  4 ปีที่แล้ว

      Download the node.js source code developed in the video: api-university.com/blog/spotify-api-how-to-get-an-oauth-access-token-api-review-series/

    • @charliestableford3709
      @charliestableford3709 4 ปีที่แล้ว

      @@Api-university This link brings me to another version of the video but not the source code?

    • @Api-university
      @Api-university  4 ปีที่แล้ว

      @@charliestableford3709should work now, just sign-up below the video