4

I tried to request a oauth token from hms server, but it always return missing required parameter: client_id to me.

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

header: Content-Type application/x-www-form-urlencoded

response: 
{
    "sub_error": 20001,
    "error_description": "missing required parameter: client_id",
    "error": 1102
}
zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
ccd
  • 5,788
  • 10
  • 46
  • 96

2 Answers2

2

This is because the params should be set in x-www-form-urlencoded.

url: https://oauth-login.cloud.huawei.com/oauth2/v3/token

header: Content-Type application/x-www-form-urlencoded

x-www-form-urlencoded:
grant_type    client_credentials
client_id     XX
client_secret XX
ccd
  • 5,788
  • 10
  • 46
  • 96
1
"sub_error": 20001,
"error_description": "missing required parameter: client_id",
"error": 1102

enter image description here

Based on the error information, and according to this Docs, It can be determined that the client_id field is empty or incorrect.

You could refer to this Docs to set.

enter image description here

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108