[Huawei Developers] John Wo:
Recently, a developer needed to access HUAWEI AppGallery Connect API and create a product through the PMS API (server API). However, when Postman was used for basic service interconnection tests, the error message "403 client token authorization fail" was displayed.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201016061220.51218489980326246746519543261802:50511102025738:2800:B25B191EF4A93A63D048809B24D7C0C75072B9C974B04DD0C9C630DCC8DCEAC2.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201016061220.51218489980326246746519543261802:50511102025738:2800:B25B191EF4A93A63D048809B24D7C0C75072B9C974B04DD0C9C630DCC8DCEAC2.png[/IMG]​

They checked the error code description and found that the error was caused by an authentication failure.

1. To solve the problem, they first confirmed that the client ID used for applying for the token had sufficient permission.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201016061235.09726687738391496606956009782087:50511102025738:2800:C41E053DE1C19E7E3CA83D8461FD2A9A3862AAA81DBC1CB8141173B7EC146BD6.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201016061235.09726687738391496606956009782087:50511102025738:2800:C41E053DE1C19E7E3CA83D8461FD2A9A3862AAA81DBC1CB8141173B7EC146BD6.png[/IMG]​

2. The official document suggested that the project associated with the API client be selected as N/A. They created an API client and associated it with a project. An app ID in this project was 100xxx591. However, the app ID in the Postman service request was 101xxx531, which might have caused the authentication failure.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201016061309.99746476809205180071809608868238:50511102025738:2800:7EFC7B29F993BD32D4A567FC7F1F2552872F53431C7DDC34B92CEA36BDAB784F.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201016061309.99746476809205180071809608868238:50511102025738:2800:7EFC7B29F993BD32D4A567FC7F1F2552872F53431C7DDC34B92CEA36BDAB784F.png[/IMG]​

3. To verify the assumption, they created an API client and selected N/A (indicating that all projects are supported) and used the client to request a token. The process then went well.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201016061330.52249485275590769307085814796162:50511102025738:2800:B8123C8E8F623B19E114EE4586250406629B9CE6522C8BEBEE8779DE63FA3AEB.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201016061330.52249485275590769307085814796162:50511102025738:2800:B8123C8E8F623B19E114EE4586250406629B9CE6522C8BEBEE8779DE63FA3AEB.png[/IMG]​

To draw a conclusion, If Huawei's 403 authentication failure occurs, you can verify the permission first, and then check the associated projects.

Reference:

For details about the PMS API, please refer to:

https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agcapi-addproduct

For more details, you can go to:

Official website

Development Documentation page, to find the documents you need

Reddit to join our developer discussion

GitHub to download demos and sample codes

Stack Overflow to solve any integration problems