Spotify.NET/SpotifyAPI.Web.Examples.ASP
2020-05-02 13:04:26 +02:00
..
Controllers Started with Unit Tests and added .editorconfig for syntax settings 2020-05-02 13:04:26 +02:00
Models Started with Unit Tests and added .editorconfig for syntax settings 2020-05-02 13:04:26 +02:00
Properties Refactor ASP.NET Example to use AspNet.Security.OAuth.Spotify 2019-11-19 10:37:42 +01:00
Views Started with Unit Tests and added .editorconfig for syntax settings 2020-05-02 13:04:26 +02:00
wwwroot Refactor ASP.NET Example to use AspNet.Security.OAuth.Spotify 2019-11-19 10:37:42 +01:00
appsettings.Development.json Restructured Examples and added new one 2019-11-12 15:02:36 +01:00
appsettings.json Refactor ASP.NET Example to use AspNet.Security.OAuth.Spotify 2019-11-19 10:37:42 +01:00
Program.cs VSCode Formatter - Also bumped tests to net core 3.1 2020-03-09 20:47:39 +01:00
README.md Update README.md 2019-11-20 16:25:38 +01:00
SpotifyAPI.Web.Examples.ASP.csproj Refactor ASP.NET Example to use AspNet.Security.OAuth.Spotify 2019-11-19 10:37:42 +01:00
Startup.cs VSCode Formatter - Also bumped tests to net core 3.1 2020-03-09 20:47:39 +01:00

ASP.NET Core Spotify Example

This project provides an example ASP .NET Core Web Application, which utilizes SpotifyAPI.Web and AspNet.Security.OAuth.Spotify to authenticate the user from Spotify and retrieve his saved library tracks.

Important files/lines

Most of the important configuration is inside of Startup.cs. It reads the client_id and client_secret from the configration store, so make sure you run the following commands in the project directory:

dotnet user-secrets set client_secret YOUR_CLIENT_SECRET
dotnet user-secrets set client_id YOUR_CLIENT_ID

Also, it specifies the callback URL (/callback). This has to be registered in your Spotify App Settings (http://localhost:5000/callback)

The actual request to Spotify and making sure that the user is authenticated happens in Controllers/HomeController.cs, which should be self explanatory.