Skip to content

Added Proxy Configuration #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ CredentialUtil.Load(“YAML config file path”);
or
CredentialUtil.Load(System.IO.StreamReader);

- If needed, you can add an IWebProxy.
[source,csharp]
IWebProxy webProxy = new WebProxy();
//Your configuration here
ProxyUtil.WebProxy = webProxy;

- Once the credentials are loaded, call any operation on **OAuth2Api**.
1. **GetApplicationToken**: Use this operation when the application request an access token to access their own resources,
not on behalf of a user. Learn more about https://developer.ebay.com/api-docs/static/oauth-client-credentials-grant.html[Client Credentials grant flow].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,15 @@ private OAuthResponse FetchToken(OAuthEnvironment environment, String requestPay
BaseUrl = new Uri(environment.ApiEndpoint())
};

//Get proxy
IWebProxy proxy = ProxyUtil.WebProxy;

//Initialize proxy
if (proxy != null)
{
client.Proxy = proxy;
}

//Create request
RestRequest request = new RestRequest(Method.POST);

Expand Down
13 changes: 13 additions & 0 deletions ebay-oauth-csharp-client/eBay/ApiClient/Auth/OAuth2/ProxyUtil.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Text;

namespace eBay.ApiClient.Auth.OAuth2
{
public static class ProxyUtil
{
public static IWebProxy WebProxy;
}
}