Search code examples
androidhuawei-mobile-serviceshuawei-developers

Huawei In App Purchase, implemented everything correctly but still getting the error : authorization format invalid


I am trying to implement Huawei in App Purchase kit to my application.

The request I am sending to the server is here:

request {"purchaseToken":"0000017343ec91821b076fd75f71103a5a85595d2dfd245d708fd6058e676f857792b83622c7fd51x434e.1.100059717","productId":"1007"}

I am following this guide here : https://developer.huawei.com/consumer/en/codelab/HMSInAppPurchase/index.html#0

I am following the same steps but I am getting an error message from server which says :

result: {"responseCode":"6","subErrCode":"211","responseMessage":"6-211-authorization format invalid"}

Which part I might be doing wrong?


Solution

  • In the error you are getting, it says "authorization format invalid". This means your ignature verification data format is invalid. The possible errors might be :

    1. The token in the request header is not encrypted in Base64 mode.
    2. The character string APPAT is not appended before the access token for authorization. The correct access token is similar to APPAT:thisIsAppAtVaule.

    for more information, please check : https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/iap-FAQ