Error API EBAY GET AUTH TOKEN
Hi Everyone,
i have a problem with get AUTH TOKEN with script PHP.
I used this code script :
$url = "https://api.ebay.com/ws/api.dll";
$requestXmlBody = '<?xml version="1.0" encoding="utf-8"?>
apis:eBLBaseComponents">
<RuName>'.$runame.'</RuName>
</GetSessionIDRequest>';
$headers = array(
'X-EBAY-API-COMPATIBILITY-LEVEL: 967',
'X-EBAY-API-DEV-NAME: ' . $devid,
'X-EBAY-API-APP-NAME: ' . $appid,
'X-EBAY-API-CERT-NAME: ' . $certid,
'X-EBAY-API-CALL-NAME: GetSessionID',
"X-EBAY-API-SITEID: ".$siteid,
'Content-Type: text/xml'
);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestXmlBody);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($curl);
if ($response === false)
{
die('Error: ' . curl_error($curl));
}
curl_close($curl);
$responseXml = simplexml_load_string($response);
$sessionID = (string)$responseXml->SessionID;
$requestXmlBody = '<?xml version="1.0" encoding="utf-8"?>
apis:eBLBaseComponents">
<SessionID>'.$sessionID.'</SessionID>
</FetchTokenRequest>';
$headers = array(
'X-EBAY-API-COMPATIBILITY-LEVEL: 967',
'X-EBAY-API-DEV-NAME: ' . $devid,
'X-EBAY-API-APP-NAME: ' . $appid,
'X-EBAY-API-CERT-NAME: ' . $certid,
'X-EBAY-API-CALL-NAME: FetchToken',
"X-EBAY-API-SITEID: ".$siteid,
'Content-Type: text/xml'
);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestXmlBody);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($curl);
if ($response === false) {
die('Error: ' . curl_error($curl));
}
curl_close($curl);
$responseXml = simplexml_load_string($response);
$token = (string)$responseXml->eBayAuthToken;WHERE:
$siteid is valorized with id language
$devid is my devid
$appid is my appid
$certid is my certid
$runame is my runame
all parameters were taken from the following page: https://developer.ebay.com/my/keys
But when I get to the end of the script it gives me the following error despite having done all the procedures reported in the API generation procedure including the acceptance of the privacy:
Is there anyone who can give me information on this problem and tell me if I'm doing something wrong?
I await yours.
Thank you.
Thank you.
5276alberto-stm
Posted 3 years ago·Last reply 3 years ago
3 comments
developer_support@ebay
Hi @5276alberto-stm
The error message you are receiving normally occurs if the authorization process for obtaining your token was interrupted or not completed in some manner.
Please try either of these to fix the above error.
For example:
https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&runame=TestRUName&SessID=XXXXXXXXXXXXXXXXXXXXXXXXX - This is wrong, this might malformat the GET params(SessionID).
Please change this to https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&runame=TestRUName&SessID=XXXXXXXXXXXXXXXXXXXXXXXXX - This is correct.
* Once you have clicked on the required link you will be taken to eBay where you can log in. eBay should then present you with a 'Grant application access' page. Clicking on the 'I agree' button will generate your new token. When performing the process you should ensure that you do not navigate away from any page sent from eBay and if at all possible do not open multiple browser tabs when clicking on links.
For more details, please see Getting Auth`n`Auth tokens.
5276alberto-stm
OP3 years agoHi Support,
I tried to follow the instructions you gave me but unfortunately the problem persists. I would like to point out that since it has to be done dynamically we don't have the opportunity to tell our client to take the address https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&runame=TestRUName&SessID=XXXXXXXXXXXXXXXXXXXXXXXXXX and do login every time.
We will need to have a solution that allows us to run a cron and get the data from Ebay all in a dynamic way and without carrying out intermediate activities to get the TOKEN.
I await yours.
Thank you,
5276alberto-stm
OP3 years agoHi Support,
We have been waiting for your reply for a month.
I would kindly ask for an answer within a short time in order to unlock the project.
I tried to follow the instructions you gave me but unfortunately the problem persists. I would like to point out that since it has to be done dynamically we don't have the opportunity to tell our client to take the address https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&runame=TestRUName&SessID=XXXXXXXXXXXXXXXXXXXXXXXXXX and do login every time.
We will need to have a solution that allows us to run a cron and get the data from Ebay all in a dynamic way and without carrying out intermediate activities to get the TOKEN.
I await yours.
Thank you,