3

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 ?!

User987
  • 3,663
  • 15
  • 54
  • 115
  • Anyone guys ? =) – User987 Jul 19 '17 at 07:20
  • I'm just trying to implement eBay into my MVC application, and I'm having the exact same problem. A year later and there still seems to be very little information online on how to do this. – Gavin Coates Jan 28 '18 at 16:26
  • @GavinCoates It's not possible to do it via SDK, you're just gonna have to do it via the old method by constructing an XML request and do it so. :) – User987 Jan 28 '18 at 17:31
  • @GavinCoates I know right, eBay's documentation and API are horrible! – User987 Jan 28 '18 at 17:31
  • "Supports the latest features through regularly scheduled updates by eBay" - except OAuth, which all your documentation pushes you towards for authenticating! Really poor from eBay! – Gavin Coates Jan 29 '18 at 10:04
  • @GavinCoates Yeah I mean really... Also the response time from their API is horrible... I pull like 15 millions calls from them per day, and the main bottleneck to performance of our app is due to the eBay's terrible API .. – User987 Jan 29 '18 at 13:56
  • Hay Imad did you found a solution on that finally? – Liakat Hossain Jun 07 '18 at 18:45
  • @LiakatHossain Yes, .NET SDK doesn't supports, or at least didn't support OAuth token at the time I posted this... The way eBay suggested it to be done at the time was to do it via web call directly, and then you can choose which token type to use ... Auth'Auth or OAuth – User987 Jun 09 '18 at 10:58
  • Apparently Version 1055 of the SDK now supports this. See http://developer.ebay.com/DevZone/WindowsSDK/docs/Release%20Notes/ReleaseNotes.html for more information. I haven't tested this yet as I contacted their support and I was able to two separate key sets for using the old and new API. – nfplee Sep 19 '18 at 11:06

0 Answers0