question

icecarrots avatar image
0 Likes"
icecarrots asked ·

using OAuth token in Trading API C#

Hi. so I have my eBay OAuth handshake done and working with no issue and I can do all the SellApi calls that I need. However, how do I use the trading API with the same access_token, What ever I try I get a error, var apiContext = new ApiContext { SoapApiServerUrl = " https://api.ebay.com/wsapi";, ApiCredential = new ApiCredential { // Slick.Dealz Live Account ApiAccount = new ApiAccount { Application = "application", Certificate = "certificate", Developer = "developer", }, eBayToken = "eBayToken" }, }; var apiCall = new GetApiAccessRulesCall(apiContext); apiCall.Execute(); return apiCall.ApiResponse; However this works with no issue. var stringtoIncode = data.ClientId + ":" + data.ClientSecret; var bast64Code = new Base64Encode().Get(stringtoIncode); var ebay = "grant_type=authorization_code&code=" + refreshToken + "&redirect_uri=redirect_uri"; using(HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(" https://api.ebay.com/";); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", bast64Code); using(StringContent jsonContent = new StringContent(ebay)) { jsonContent.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded"); Task response = client.PostAsync("identity/v1/oauth2/token", jsonContent); Task token; if(response.Result.IsSuccessStatusCode) { token = response.Result.Content.ReadAsAsync (); var result = new IdentityResponse() { access_token = token.Result.access_token, refresh_token_expires_in = token.Result.refresh_token_expires_in, expires_in = token.Result.expires_in, refresh_token = token.Result.refresh_token, token_type = token.Result.token_type }; return result; } else Thanks for any help
trading apiauth-token.net api
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

gragra33 avatar image
0 Likes"
gragra33 answered ·
I don't use the eBay .Net SDK but it looks like you are missing the ruName header field...
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

icecarrots avatar image
0 Likes"
icecarrots answered ·
@gragra33 Stupid question,. what do you use?
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

gragra33 avatar image
0 Likes"
gragra33 answered ·
Your "ruName" is required. Go to your eBay Developer Dashboard, in Application Keys choose "User Tokens" > "Get a Token from eBay via Your Application" > and you will find your "RuName (eBay Redirect URL name)". From there, the documentation explains how and when to use it.
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.