It looks like you've modified the PowerShell script to some degree. For example, client state is different. I suggest start with this script exactly as documented. Does that work? If so please try substituting with the sample client ID with your own. Does that work? And go from there.
Error when trying to obtain Access Token and Refresh Token - BING ADS API
Hello everyone:
i am trying to get my company's campaing spends and other custom reports via The Bing Ads Api. I've already registered an App in Azure and already have my developer Token. I've followed the steps mentioned in [1]: https://learn.microsoft.com/en-us/advertising/guides/authentication-oauth-get-tokens?view=bingads-13. I've exectued the powershell code from my console and once i grant consent, i recieve an URL like this:
I've read that the console returns the access token, access token duration and refresh token once i enter a code contained in the previous URL. i've tried with every part of the previous URL, but my console only returns error messages like this
"... Invoke-WebRequest : {"error":"invalid_grant","error_description":"AADSTS9002313: Invalid request. Request is malformed
or invalid.\r\nTrace ID: 77da3239-cf4a-4a39-bbbb-079cdbce9f00\r\nCorrelation ID:
5bab9c16-d200-4048-9f1b-7e0942cc4abf\r\nTimestamp: 2021-10-16
00:33:12Z","error_codes":[9002313],"timestamp":"2021-10-16 00:33:12Z","trace_id":"77da3239-cf4a-4a39-bbbb-079cdbce9f00"
,"correlation_id":"5bab9c16-d200-4048-9f1b-7e0942cc4abf","error_uri":"https://login.microsoftonline.com/error?code=9002
313"}...".
i don't really know what could i be doing wrong.
please help me.
Diego Acevedo
1 answer
Sort by: Most helpful
-
Eric Urban - MSFT 626 Reputation points Microsoft Employee
2021-10-24T14:09:34.273+00:00