All Projects → pimmerks → SpotifyWebApi

pimmerks / SpotifyWebApi

Licence: MIT license
A .net core wrapper for the Spotify Web API

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to SpotifyWebApi

spotify-vibe-check
Spotify Vibe Checker Web App to vibe check your Spotify Playlists! (currently broken due to CORS)
Stars: ✭ 24 (+26.32%)
Mutual labels:  playlist, spotify, spotify-api, spotify-web-api
spotify-true-random
🔀 An application for unbiased truly random playlist and library shuffling with Spotify.
Stars: ✭ 51 (+168.42%)
Mutual labels:  spotify, spotify-api, spotify-web-api
laravel-spotify
Laravel-Spotify is a simple wrapper around the Spotify Web API that makes working with its endpoints a breeze!
Stars: ✭ 141 (+642.11%)
Mutual labels:  spotify, spotify-api, spotify-web-api
Partify
This is a free open source Spotify-powered app that lets users host parties and have guests connect using their smartphones to submit and vote on songs. The app will only play the highest voted song and can connect to personal playlists.
Stars: ✭ 37 (+94.74%)
Mutual labels:  playlist, spotify, spotify-api
spotipy2
The next generation Spotify Web API wrapper for Python 3.7+
Stars: ✭ 25 (+31.58%)
Mutual labels:  spotify, spotify-api, spotify-web-api
SpotMusicGen
A Program that creates a Spotify playlist from a YouTube Playlist
Stars: ✭ 47 (+147.37%)
Mutual labels:  spotify, spotify-api, spotify-web-api
react-redux-spotify
React + Redux + Spotify web api boilerplate project
Stars: ✭ 14 (-26.32%)
Mutual labels:  spotify, spotify-api, spotify-web-api
remixr
Discover new music based on the Spotify playlists you know and love!
Stars: ✭ 37 (+94.74%)
Mutual labels:  spotify, spotify-api, spotify-web-api
Spotify Web Api Js
A client-side JS wrapper for the Spotify Web API
Stars: ✭ 1,313 (+6810.53%)
Mutual labels:  spotify, wrapper, spotify-api
Exportify
Export/Backup Spotify playlists using the Web API
Stars: ✭ 1,611 (+8378.95%)
Mutual labels:  spotify, spotify-api, spotify-web-api
Weixinmpsdk
微信全平台 SDK Senparc.Weixin for C#,支持 .NET Framework 及 .NET Core、.NET 6.0。已支持微信公众号、小程序、小游戏、企业号、企业微信、开放平台、微信支付、JSSDK、微信周边等全平台。 WeChat SDK for C#.
Stars: ✭ 7,098 (+37257.89%)
Mutual labels:  nuget, net-core, net-core-2
Coverify
🎧 Design fresh album cover for your Spotify playlists
Stars: ✭ 167 (+778.95%)
Mutual labels:  playlist, spotify, spotify-api
Opengl.net
Modern OpenGL bindings for C#.
Stars: ✭ 473 (+2389.47%)
Mutual labels:  nuget, net-core, net-framework
spotify-release-list
📅 Display list of Spotify releases from artists you follow
Stars: ✭ 142 (+647.37%)
Mutual labels:  spotify, spotify-api, spotify-web-api
SpiceSharp
Spice# is a cross-platform electronic circuit simulator based on Berkeley Spice - the mother of commercial industry-standard circuit simulators.
Stars: ✭ 146 (+668.42%)
Mutual labels:  nuget, net-core, net-framework
Spotify Web Api Kotlin
Spotify Web API wrapper for Kotlin/JVM, Kotlin/Android, Kotlin/JS, and Kotlin/Native. Includes a Spotify Web Playback SDK wrapper for Kotlin/JS, and a spotify-auth wrapper for Kotlin/Android
Stars: ✭ 86 (+352.63%)
Mutual labels:  spotify, wrapper, spotify-api
Quaggify
A spotify clone made in Swift 4 consuming the Spotify API
Stars: ✭ 30 (+57.89%)
Mutual labels:  playlist, spotify, spotify-api
Singlespotify
🎵 Create Spotify playlists based on one artist through the command line
Stars: ✭ 254 (+1236.84%)
Mutual labels:  playlist, spotify, spotify-api
whichone
A personalised Spotify quiz based on the music you listen to
Stars: ✭ 14 (-26.32%)
Mutual labels:  spotify, spotify-web-api
Krypton-Toolkit-Suite-Extended-NET-5.470
An extension to the Krypton Toolkit suite of controls for .NET framework 4.7
Stars: ✭ 51 (+168.42%)
Mutual labels:  nuget, net-framework

Push NuGet version (SpotifyWebApi-Core) NuGet license

SpotifyWebApi - Core

A .net Core wrapper for the Spotify Web Api.

Nuget package

Installing the package is easy.

Using the package manager console:

PM> Install-Package SpotifyWebApi-Core

Using the dotnet CLI:

> dotnet add package SpotifyWebApi-Core

Getting an authentication token

Client credentials:

var token = ClientCredentials.GetToken(new AuthParameters
{
    ClientId = "clientId",
    ClientSecret = "clientSecret",
    Scopes = Scope.All,
});

Note: A client credentials token cannot access any personal data.
The Token class has a usefull property to check this: token.CanAccessPersonalData

Authorization code:

Start the authorization code process by retrieving the authentication url:

var state = Guid.NewGuid().ToString(); // Save this state because you must check it later

var parameters = new AuthParameters
{
    ClientId = "clientId",
    ClientSecret = "clientSecret",
    RedirectUri = "https://.../callback",
    Scopes = Scope.All,
    ShowDialog = true
};

var url = AuthorizationCode.GetUrl(parameters, state);

At this point you should start a webserver listening on the RedirectUri and the the client/user should login to Spotify.
The webserver should expect the following query parameters: ?code=code&state=state&error=error

// The retreived callback:
var retrievedState = "retrievedState";
var retrievedCode = "code";
var retreivedError = "";

if (state != retrievedState)
{
    throw new Exception("State did not match!");
}

var token = AuthorizationCode.ProcessCallback(parameters, retrievedCode, retreivedError);

// Use the api with access to personal data.
var api = new SpotifyWebApi(token);
var me = await api.UserProfile.GetMe();

A token received with the AuthorizationCode can also be refreshed:

// Refresh a token when its expired
if (token.IsExpired)
{
    token = AuthorizationCode.RefreshToken(parameters, token);
}

Using the api

After a token has been retrieved, we can use the api:

Getting a playlist and the playlist tracks:

ISpotifyWebApi api = new SpotifyWebApi(token);

var playlist = await spotify.Playlist.GetPlaylist(id);
var tracks = await spotify.Playlist.GetPlaylistTracks(id);

TODO:

  • Add documentation
  • Add api examples
  • Implement more endpoints
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].