How to call the Spotify API from C#

前端 未结 3 583
离开以前
离开以前 2021-02-06 06:14

I\'m trying to call the spotify API with C#. Unfortunately, I\'m already stuck with getting the access token

This is how I tried to get it:

         


        
3条回答
  •  执念已碎
    2021-02-06 06:29

    Just encode your App ClientId and ClientSecret:

    var token = Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0}:{1}",this.CliendId,this.ClientSecret)));
    

    Replace properly:

    request.Headers.Add("Authorization", "Basic " + token);
    

    That's it!

提交回复
热议问题