Spotify.NET/SpotifyAPI.Web/Http/TokenHeaderAuthenticator.cs
2020-05-02 13:04:26 +02:00

24 lines
493 B
C#

using System.Threading.Tasks;
namespace SpotifyAPI.Web.Http
{
public class TokenHeaderAuthenticator : IAuthenticator
{
public TokenHeaderAuthenticator(string token, string tokenType)
{
Token = token;
TokenType = tokenType;
}
public string Token { get; set; }
public string TokenType { get; set; }
public Task Apply(IRequest request)
{
request.Headers["Authorization"] = $"{TokenType} {Token}";
return Task.CompletedTask;
}
}
}