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.
413 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Getting this error while trying to get refreshtoken :
System.Private.CoreLib: Exception while executing function: func-bing-ads. Microsoft.BingAds: Couldn't request OAuth AccessTokens. Please check the Details property for more information. Details: invalid_grant - XYZ: The user or administrator has not consented to use the application with ID 'xyz' named ' Bing Ads Extractor'. Send an interactive authorization request for this user and resource.
Code:
//the following gets the auth and refresh token
var apiEnvironment = ApiEnvironment.Production;
var oAuthDesktopMobileAuthCodeGrant = new OAuthDesktopMobileAuthCodeGrant(
_config["clientId"],
apiEnvironment
);
var additionalParams = new List<KeyValuePair<string, string>>()
{
new KeyValuePair<string, string>(
"client_secret",
_config["bing:clientSecret"])
};
var str = oAuthDesktopMobileAuthCodeGrant.GetAuthorizationEndpoint();
var auth = await oAuthDesktopMobileAuthCodeGrant.RequestAccessAndRefreshTokensAsync(accesstokenAsString , additionalParams);// Error Returns from here