public virtual void Authenticate(IRestClient client, IRestRequest request) { var tokenProxy = new TokenProxy(); var token = tokenProxy.RetrieveToken(this.ClientId, this.ClientSecret); request.AddAuthorization(string.Format(CultureInfo.CurrentCulture, "{0} {1}", token.TokenType, token.Token)); request.AddAccountId(this.PublisherId); }
private static TokenProxy CreateTokenProxy(JwtSecurityToken jwtToken) { var tokenProxy = new TokenProxy { Token = $"Bearer {new JwtSecurityTokenHandler().WriteToken(jwtToken)}", ExpirationDate = jwtToken.ValidTo }; return(tokenProxy); }
static TokenProxy() { Instance = new TokenProxy(); }