Hello Oliver,
Good day!
The reason for the 'redirect_uri' error could be because of the below reasons:
- Redirect URI Must Match App Registration
- The
redirect_uri=https://login.microsoftonline.com/common/oauth2/nativeclientis 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.
- The
- Endpoint Choice
- You are using the
commonendpoint, which is correct for multi-tenant apps supporting both work/school and personal accounts. - If your app is single-tenant, replace
commonwith your tenant ID:https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/authorize
- You are using the
- App Registration Settings
- Ensure:
-
signInAudienceis 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