【问题标题】:HUAWEI Push - API for obtaining an access token not workingHUAWEI Push-获取访问令牌的API不起作用
【发布时间】:2021-06-11 01:53:18
【问题描述】:

当我使用这个 api 来获取访问令牌时: https://oauth-login.cloud.huawei.com/oauth2/v3/token?grant_type=client_credentials&client_id=****&client_secret=**** 它总是返回

{
"sub_error": 20001,
"error_description": "missing required parameter: client_id",
"error": 1102 }

虽然我发送了client_id参数

【问题讨论】:

    标签: huawei-mobile-services huawei-developers


    【解决方案1】:

    要解决此问题,请确保以下几点

    1. 你正在向服务器发送请求

    2. 确保 POST URL 为“https://oauth-login.cloud.huawei.com/oauth2/v3/token”。不要在 URL 中包含 post 参数

    3. 在 POST 请求的正文中添加以下参数,但不在此处提到的 URL 中 (https://oauth-login.cloud.huawei.com/oauth2/v3/token?grant_type=client_credentials&client_id=****&client_secret=****)

    grant_type=client_credentials

    client_id=****

    client_secret=****

    有关获取访问令牌的更多详细信息,请参阅以下链接:

    https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides-V5/open-platform-oauth-0000001053629189-V5#EN-US_TOPIC_0000001053629189__section12493191334711

    【讨论】:

      【解决方案2】:

      请使用以下方案代替宣誓认证:

      https://oauth-login.cloud.huawei.com/oauth2/v3/authorize?grant_type=client_credentials&client_id=\*\*\*\*&client_secret=\*\*\*

      如果你没有给它一个有效的client_id,它会说你有一个“无效的client_id”而不是说它是空的。希望这可以帮助。 (变化是原来说.../token?而这个说.../authorize?)

      【讨论】:

        猜你喜欢
        • 2021-08-19
        • 2020-08-06
        • 2012-01-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-04-28
        • 1970-01-01
        • 2012-08-14
        相关资源
        最近更新 更多