Cant get sandbox token for Bing Ads anymore - says redirect_uri is not valid

Oliver Chrzan 0 Reputation points
2025-06-05T19:24:40.2033333+00:00

Cant get sandbox token for Bing Ads anymore. This used to work.

I see the instructions have changed and now you need an outlook.com email vs outlook-int.com. I tried the url (with PROD_CLIENT_ID replaced with my client id):

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=PROD_CLIENT_ID&scope=openid%20profile%20https://si.ads.microsoft.com/msads.manage%20offline_access&response_type=code&redirect_uri=https%3A//login.microsoftonline.com/common/oauth2/nativeclient&state=ClientStateGoesHere&prompt=login

But it just takes me to a page with the following error: invalid_request: The provided value for the input parameter 'redirect_uri' is not valid. The expected value is a URI which matches a redirect URI registered for this client application.

It use to provide back the code you would then use to fetch the

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.
{count} votes

1 answer

Sort by: Most helpful
  1. Manoj 0 Reputation points
    2025-10-16T10:39:18.0733333+00:00

    Hello Oliver,

    Good day!

    The reason for the 'redirect_uri' error could be because of the below reasons:

    1. Redirect URI Must Match App Registration
      • The redirect_uri=https://login.microsoftonline.com/common/oauth2/nativeclient is valid only for public clients (desktop/mobile apps) and must be explicitly added in your Azure App Registration under Redirect URIs.
      • If your app is registered as a web app or confidential client, this URI will cause an error.
    2. Endpoint Choice
      • You are using the common endpoint, which is correct for multi-tenant apps supporting both work/school and personal accounts.
      • If your app is single-tenant, replace common with your tenant ID:
             https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/authorize
        
    3. App Registration Settings
      • Ensure:
      • signInAudience is set to AzureADandPersonalMicrosoftAccount if you want both MSA and work accounts.

    Corrected Sample:

    // Line breaks for legibility only
    
    https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=YOUR_CLIENT_ID
    &scope=openid%20profile%20offline_access%20https://ads.microsoft.com/msads.manage
    &response_type=code
    &redirect_uri=https%3A%2F%2Flogin.microsoftonline.com%2Fcommon%2Foauth2%2Fnativeclient
    &state=12345 &code_challenge=YOUR_CODE_CHALLENGE &code_challenge_method=S256
    &prompt=login
    
    

    Reference: https://free.blessedness.top/en-us/advertising/guides/authentication-oauth-register?view=bingads-13

    If the above steps doesn't help you resolve the issue, please step through this checklist and provide on this Bing Ads API documenatation (https://free.blessedness.top/en-us/advertising/guides/handle-service-errors-exceptions?view=bingads-13#contact-support) the results to the support team.

    Regards,

    Manoj

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.