06-12-2023 03:49 AM
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;
The end user has not completed Auth & Auth sign in flow.
06-13-2023 09:29 AM
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.
06-30-2023 12:21 AM
Hi 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,
07-31-2023 08:40 AM
Hi 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,