mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-25 07:26:28 +00:00
26 lines
566 B
C#
26 lines
566 B
C#
using System.Threading.Tasks;
|
|
|
|
namespace SpotifyAPI.Web.Http
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
}
|