Daily insights with Bing Ads script to Google Spreadsheet

MichGijs 1 Reputation point
2021-10-13T13:11:18.583+00:00

Hello,

I've used the example of https://gist.github.com/krsoninikhil/30f5b0339c3c7f35645dff1713674473 to make the script.
As I don't want to manually refresh the token every hour (since the script should run automatically every night), I used option 3 in https://learn.microsoft.com/en-us/advertising/scripts/examples/authenticating-with-google-services#option3 to get a refresh token using a PowerShell script.

I then followed the example to leave accessToken empty (https://learn.microsoft.com/en-us/advertising/scripts/examples/calling-google-services) and filled in the rest as supposed to

const credentials = {
accessToken: '',
clientId: 'myid',
clientSecret: 'my-secret',
refreshToken: 'refreshtoken-i-got-via-powershell'

Since I did that I get this message:
"error": "invalid_grant",
"error_description": "Bad Request""

I've no idea what to do, can somebody help with this? Thanks in advance

Microsoft Advertising API
Microsoft Advertising API
A Microsoft API that provides programmatic access to Microsoft Advertising to manage large campaigns or to integrate your marketing with other in-house systems.
386 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MichGijs 1 Reputation point
    2021-10-25T12:45:28.73+00:00

    Coming back to my question. It doesn't have to be connected to Google Spreadsheet. If I can just write it to a CSV, that would be great. Still stuck on what to do.

    0 comments No comments