Using OAuth2 eBay authentication with .NET SDK

Viewed 802

I have been searching throughout the internet for a solution to use OAuth2 user token with eBay's .NET SDK and could find ANY SINGLE solution. The code I have is like following:

     var ctx = new ApiContext();
        ctx.Version = "897";
        ctx.ApiCredential.ApiAccount.Application = "//something here";
        ctx.ApiCredential.ApiAccount.Developer = "//something here";
        ctx.ApiCredential.ApiAccount.Certificate = "//something here";
        ctx.ApiCredential.eBayToken = "v^1.1... // this is OAuth2 token";

        var getUser = new GetUserCall();

        getUser.OutputSelector = new string[] { "UserID","Site" };
        getUser.GetUser();

What I find really irritating is the fact that there is a possibility to use the new OAuth2 token with trading API, and I know this for a fact, because if you add an HTTP header to any Trading API call like:

X-EBAY-API-IAF-TOKEN:q2eq2eq2eq2q2eq2e

It will work, but I haven't found anywhere in the documentation to pass the IAF-TOKEN (OAuth2) token via .NET SDK calls...

Has anyone else been trying this? Is there nay way to pass the OAuth2 token via .NET SDK and then fetch the results ?

Because if I try to pass the OAuth2 token like this:

 ctx.ApiCredential.eBayToken = "v^1.1... // this is OAuth2 token";

In place where the traditional Auth'n'Auth token went, I'm getting the following error:

validation of the authentication token in api request failed.

Can someone help me out please ?!

0 Answers
Related