2020-03-09 19:47:39 +00:00
|
|
|
using System.Diagnostics;
|
2019-11-12 14:02:30 +00:00
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Microsoft.AspNetCore.Authentication;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using SpotifyAPI.Web.Examples.ASP.Models;
|
|
|
|
|
|
|
|
namespace SpotifyAPI.Web.Examples.ASP.Controllers
|
|
|
|
{
|
2020-03-09 19:47:39 +00:00
|
|
|
[Authorize(AuthenticationSchemes = "Spotify")]
|
|
|
|
public class HomeController : Controller
|
|
|
|
{
|
2020-05-02 12:04:26 +01:00
|
|
|
public IActionResult Index()
|
2019-11-12 14:02:30 +00:00
|
|
|
{
|
2020-05-02 12:04:26 +01:00
|
|
|
// var accessToken = await HttpContext.GetTokenAsync("Spotify", "access_token");
|
|
|
|
// SpotifyWebAPI api = new SpotifyWebAPI
|
|
|
|
// {
|
|
|
|
// AccessToken = accessToken,
|
|
|
|
// TokenType = "Bearer"
|
|
|
|
// };
|
2019-11-19 09:37:42 +00:00
|
|
|
|
2020-05-02 12:04:26 +01:00
|
|
|
// var savedTracks = await api.GetSavedTracksAsync(50);
|
2019-11-19 09:37:42 +00:00
|
|
|
|
2020-05-02 12:04:26 +01:00
|
|
|
return View(new IndexModel { SavedTracks = null });
|
2020-03-09 19:47:39 +00:00
|
|
|
}
|
2019-11-19 09:37:42 +00:00
|
|
|
|
2020-03-09 19:47:39 +00:00
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
|
|
public IActionResult Error()
|
|
|
|
{
|
|
|
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
2019-11-12 14:02:30 +00:00
|
|
|
}
|
2020-03-09 19:47:39 +00:00
|
|
|
}
|
2020-05-02 12:04:26 +01:00
|
|
|
}
|