Reputation: 540
I am trying to authenticate a user for the eBay Trading API, but I am unable to generate a token 100% pragmatically. I have been able to generate the SessionID, but when I send an HTTP request to the FetchToken endpoint, I get the following error (in JSON):
{
"FetchTokenResponse": {
"$": {
"xmlns": "urn:ebay:apis:eBLBaseComponents"
},
"Timestamp": [
"2016-06-04T20:57:56.002Z"
],
"Ack": [
"Failure"
],
"Errors": [
{
"ShortMessage": [
"The end user has not completed Auth & Auth sign in flow."
],
"LongMessage": [
"The end user has not completed Auth & Auth sign in flow."
],
"ErrorCode": [
"21916017"
],
"SeverityCode": [
"Error"
],
"ErrorClassification": [
"RequestError"
]
}
],
"Version": [
"949"
],
"Build": [
"E949_INTL_API_17934825_R1"
]
}
}
The XML I am sending in my POST request is:
<?xml version="1.0" encoding="utf-8"?>\
<FetchTokenRequest xmlns="urn:ebay:apis:eBLBaseComponents">\
<SessionID>MY_GENERATED_SESSION_ID</SessionID>\
</FetchTokenRequest>
where the App ID, Dev ID, and the Cert ID are all in the HTTP headers. If it makes a difference, the link to the code in a gist is here. How do I authenticate and generate a token for a user without having the user go to the login page mentioned in their documentation? If someone can point me in the right direction, I would sincerely appreciate it.
Upvotes: 1
Views: 539
Reputation: 1167
Try adding the username in the request credentials. The xml structure should be like the one below.
<?xml version="1.0" encoding="utf-8"?>
<FetchTokenRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<username>Ebay_Username_Of_User_Authentication</username>
</RequesterCredentials>
<SessionID>Session_ID_Returned_by_ebay</SessionID>
</FetchTokenRequest>
Upvotes: 2