Community Discussion
how to regenerate access token in taboola ads
Hey Team!
How to regenerate access token in taboola ads
Posted by ritik soni 5 months ago
Inquiry About "User credentials have expired"
Dear Taboola support team.
Yesterday I did oauth authentication and got a refresh_token.
I used it to access the
I accessed the following endpoint
https://backstage.taboola.com/backstage/oauth/token
Then I got the error "User credentials have expired".
I tested with a different refresh_token and got the correct access_token, so I think the client_id is correct.
What are the possible reasons for the "User credentials have expired" error?
I understand that after a year, I need to authenticate oauth again, but since I just authenticated oauth yesterday, I don't know why.
Thank you in advance for your help.
Posted by [email protected] 8 months ago
Taboola integrating with Azure Data Factory
Hi
I am trying to integrate Taboola with Azure Data Factory to build reports in Power BI. I noticed that the access tokens gets expire every 12 hours. If I wanted to automate the pipeline in the Data factory, I need to have a static access token. Could you please advise how can I get the static access token?
Posted by Dhilip Subramanian over 1 year ago
Authentication for API development requirements
I am starting development of a daily backend service to run the campaign summaries api. I'm having a little trouble following the 4 authentication types and use cases. It sounds like the Client Authentication flow is what is preferred, but it only generates a 12 hour token for us meaning we would have to grab a new token everytime the application runs.
We have typically used refresh tokens in the past for longer access tokens and a secondary service to refresh our token on a monthly interval. I am having trouble finding documentation on how to generate the initial refresh token to use with the 4th authentication method "refresh token".
If we code the service to pull a new key based on the client id and client secret multiple times a day, will this be a problem? What are the daily key generation limits using the preferred method 1 listed in documentation?
Posted by John B. over 1 year ago
Access Taboola API with R
Has anyone tried this and can provide information and recommendations? Which R package did you use? How did you go about it?
I tried the httr package and used the code below:
url = 'https://ads.taboola.com//backstage/api/1.0/[account_id]/campaigns/'
r <- GET(url = 'https://ads.taboola.com//backstage/oauth/token',
config = list(username, password, type = "basic")))
data <- r$content
The account ID was not alphabetical, it was numerical. and the username and password are for the ad campaigns account. I did not get any media fields, even though the response showed 200 - which confirmed some sort of connection was made.
Posted by Senan Mele about 2 years ago
Issues connecting to API for new environment
Greetings,
We've worked with the backstage API a bit before, but for a new project, we had a sandbox environment set up for testing purposes.
We are having difficulty getting our API call to work, and the errors that are returning are not at all helpful. I really wish the API responded with more information to help troubleshoot.
If we use the numerical account ID provide by our account manager we get the following error:
{http_status: 403, message: "Requested action is forbiddenβ}
If we use the alpha string ID ie. "Your Account Sandbox Name" with letters and spaces we get the following error:
"Bad Request"
Our payload follows the JSON structure outlined here:
https://developers.taboola.com/backstage-api/reference#creating-a-batch-of-campaign-items
That is the method we are calling from our application, which submits the JSON object via an AJAX post.
Here is a section of our code to show what we are doing:
$url = 'https://backstage.taboola.com/backstage/oauth/token';
$data = array('client_id' => $taboolaCID, 'client_secret' => $taboolaSecret, 'grant_type' => 'client_credentials');
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$taboolaAccessToken = json_decode($result)->{'access_token'};
$ch = curl_init('https://backstage.taboola.com/backstage/api/1.0/'.$taboolaAccount.'/campaigns/'.$campaign_id.'/items/mass' );
$payload = json_encode($collection, JSON_UNESCAPED_SLASHES);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, βOur Application Name');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload );
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'cache-control: no-cache',
'Authorization: Bearer ' . $taboolaAccessToken
));
$data = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
Any assistance would be greatly appreciated.
Thanks!
Posted by Chris Ellerby almost 3 years ago