question

nobleappliancecenterllc avatar image
0 Likes"
nobleappliancecenterllc asked

GetUser Request Invalid IAF Token

I apologize if this is the incorrect forum for this. I am trying to do a GetUser request through the Trading API, here is my server code let method = 'POST'; let endpoint = ' https://api.ebay.com/ws/api.dll'; let params = { headers: { "X-EBAY-API-SITEID": "0", "X-EBAY-API-COMPATIBILITY-LEVEL": "967", "X-EBAY-API-CALL-NAME": "GetUser", "X-EBAY-API-IAF-TOKEN": $token_from_redirect_url }, content: ` en_US High ` }; let xmlResponse = HTTP.call(method, endpoint, params); I am getting an error saying the IAF token is invalid. The token itself is much shorter than the OAuth tokens shown in the API Explorer, so I am not sure if I have to do something else with this token before I try to do the GetUser Request. Here is the response I am getting: 2018-04-30T15:35:53.266Z Failure Invalid IAF token. IAF token supplied is invalid. 21916984 Error RequestError 1045 E1045_CORE_APISIGNIN_18614794_R1 Is there something I must do with this $token in the URL that I get after the redirect? Maybe using it to get the correct token that I want to store? I just don't know. Thank you for your help.
trading apigetuser
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.

nobleappliancecenterllc avatar image
0 Likes"
nobleappliancecenterllc answered
The issue was that I was using the word 'data' or 'body' for my data. I use Meteor and I should have been using 'params' instead. Kind of a silly but frustrating reason for the error, but I was able to get the token finally this way.
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.

nobleappliancecenterllc avatar image
0 Likes"
nobleappliancecenterllc answered
So I did some reading, and it appears I was doing the request completely wrong. I was also not encoding my credentials nor my authorization code. Here is what I think I should have done in place of OP code (and what I am currently trying): let $base64Creds // My OAuth credentials after being Base64-encoded let $code // My Authorization Code after being URI-encoded let method = 'POST'; let endpoint = ' https://api.ebay.com/identity/v1/oauth2/token'; let parameters = { headers: { "Content-Type": "application/x-www-form-urlencoded", "Authorization": "Basic "+$base64Creds }, body: { "grant_type": "authorization_code", "code": $code, "redirect_uri": $my_RuName } }; let xmlResponse = HTTP.call(method, endpoint, parameters); The error I am receiving now is `unsupported_grant_type` with the description `grant type in request is not supported by the authorization server`
· 1
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.

Do I have the wrong value entered for "grant_type"?
0 Likes 0 ·

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.