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"; }