public PayPalHttpClient(PayPalEnvironment environment, string refreshToken) : base(environment) { this.refreshToken = refreshToken; gzipInjector = new GzipInjector(); authorizationInjector = new AuthorizationInjector(this, environment, refreshToken); AddInjector(this.gzipInjector); AddInjector(this.authorizationInjector); }
public RefreshTokenRequest(PayPalEnvironment environment, string code) : base("/v1/identity/openidconnect/tokenservice", HttpMethod.Post, typeof(RefreshToken)) { this.Headers.Authorization = new AuthenticationHeaderValue("Basic", environment.AuthorizationString()); this.Body = new Dictionary <string, string>() { { "grant_type", "authorization_code" }, { "code", code }, }; this.ContentType = "application/x-www-form-urlencoded"; }
public AccessTokenRequest(PayPalEnvironment environment, string refreshToken = null) : base("/v1/oauth2/token", HttpMethod.Post, typeof(AccessToken)) { this.Headers.Authorization = new AuthenticationHeaderValue("Basic", environment.AuthorizationString()); var body = new Dictionary <string, string>() { { "grant_type", "client_credentials" } }; if (refreshToken != null) { body["grant_type"] = "refresh_token"; body.Add("refresh_token", refreshToken); } this.Body = body; this.ContentType = "application/x-www-form-urlencoded"; }
public AuthorizationInjector(HttpClient client, PayPalEnvironment environment, string refreshToken) { this.environment = environment; this.client = client; this.refreshToken = refreshToken; }
public PayPalHttpClient(PayPalEnvironment environment) : this(environment, null) { }