PMS API报错403 client token authorization fail

Recent projects need to connect to Huawei's Connect API business, and hope to realize the creation of products through the PMS API server interface. As a result, the 403 client token authorization fail error is always reported when using postman to do the basic business connection test.
Insert picture description here

Check the description of the error code and find that the reason for the error is authentication failure:

  1. Based on previous project experience, we first checked whether the client id authority when applying for a token was insufficient. The result was the administrator authority, indicating that the authority was sufficient.
    Insert picture description here

  2. Later, I carefully read the official website documents. The official document suggests that when creating an API client, the project associated with the client should be located N/A. What I associate here is a "project test" I created casually, and the project is associated below The appid of the application is 100xxx591, but the appid in the postman service request is 101XXX531 . The preliminary judgment is that this caused the authentication to fail.
    Insert picture description here

  3. Finally, in order to verify the idea, a new API client with the associated project NA (indicating support for all projects) was created, and the client was used to request tokens, and subsequent business requests were finally normal.
    Insert picture description here

I hereby make a business summary. If you encounter Huawei's 403 authentication failure error, first look at the permissions and then the associated projects.

Reference content:
PMS create product API reference: https://developer.huawei.com/consumer/cn/doc/development/AppGallery-connect-References/agcapi-addproduct


Source: https://developer.huawei.com/consumer/cn/forum/topicview?tid=0202358285225370885&fid=0101271690375130218
Author: Drum Chao

Guess you like

Origin blog.csdn.net/weixin_44708240/article/details/108746269