mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 14:46:26 +00:00
27 lines
588 B
C#
27 lines
588 B
C#
using System.Threading.Tasks;
|
|
using SpotifyAPI.Web.Http;
|
|
|
|
namespace SpotifyAPI.Web
|
|
{
|
|
public class TokenAuthenticator : IAuthenticator
|
|
{
|
|
public TokenAuthenticator(string token, string tokenType)
|
|
{
|
|
Token = token;
|
|
TokenType = tokenType;
|
|
}
|
|
|
|
public string Token { get; set; }
|
|
|
|
public string TokenType { get; set; }
|
|
|
|
public Task Apply(IRequest request, IAPIConnector apiConnector)
|
|
{
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
|
|
request.Headers["Authorization"] = $"{TokenType} {Token}";
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|
|
}
|