Skip to content

Update scope url for SANDBOX MSA_PROD#317

Open
tburmawalaupgrade wants to merge 1 commit intoBingAds:mainfrom
tburmawalaupgrade:patch-1
Open

Update scope url for SANDBOX MSA_PROD#317
tburmawalaupgrade wants to merge 1 commit intoBingAds:mainfrom
tburmawalaupgrade:patch-1

Conversation

@tburmawalaupgrade
Copy link
Copy Markdown

Based on the article to Authenticate and Get refresh token on Sandbox : https://learn.microsoft.com/en-us/advertising/guides/authentication-oauth-quick-start?view=bingads-13

@tburmawalaupgrade
Copy link
Copy Markdown
Author

@xinyuwen2 please review

@zheplusplus
Copy link
Copy Markdown

Thank you.

To those who search for a solution for this error like me.

bingads.exceptions.OAuthTokenRequestException: error_code: invalid_scope, error_description: AADSTS70011: The provided request must include a 'scope' input parameter. The provided value for the input parameter 'scope' is not valid. The scope https://si.ads.microsoft.com is not valid. The scope format is invalid. Scope must be in a valid URI form <https://example/scope> or a valid Guid <guid/scope>. Trace ID: ...

Before this PR is merged and released, the typo can be patched in this way

def patch_sandbox_auth_scope():
    from bingads.authorization import (
        _UriOAuthService,  # noqa
        SANDBOX,
        MSA_PROD,
    )

    _UriOAuthService.SCOPE[(SANDBOX, MSA_PROD)] = "https://si.ads.microsoft.com/msads.manage offline_access"

Call this patch_sandbox_auth_scope once before OAuthDesktopMobileAuthCodeGrant.request_oauth_tokens_by_refresh_token.

@xinyuwen2
Copy link
Copy Markdown
Collaborator

It has been fixed in newest version 13.0.25. Thank you all for raising the issue and providing the solution.

@zheplusplus
Copy link
Copy Markdown

It has been fixed in newest version 13.0.25. Thank you all for raising the issue and providing the solution.

Much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants