简体   繁体   English

在 HMS Push Kit API 中获取访问令牌时出现错误

[英]Getting Error while obtaining an access token in HMS Push Kit API

When I use this api to get access token:当我使用此 api 获取访问令牌时:

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

it always returns它总是返回

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

although I send client_id parameter虽然我发送 client_id 参数

To solve the issue, Please make sure the below points要解决此问题,请确保以下几点

  1. You are doing post request to the server您正在向服务器发送请求

  2. Make sure that the POSR URL is “https://oauth-login.cloud.huawei.com/oauth2/v3/token”.确保POSR URL为“https://oauth-login.cloud.huawei.com/oauth2/v3/token”。

  3. Do not include post parameters in the URL, Add below parameters in body of POST request(If you use postman tool you can find the feilds for adding parameters)不要在 URL 中包含 post 参数,在 POST 请求正文中添加以下参数(如果您使用 postman 工具,您可以找到添加参数的字段)

    grant_type=client_credentials grant_type=client_credentials

    client_id= Your Client ID client_id=您的客户 ID

    client_secret= Your Client secret client_secret=您的客户密码

For more details about fetching the access token, please refer the below link:有关获取访问令牌的更多详细信息,请参阅以下链接:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM