1

On the Android App, I managed to retrieve the token using AGConnectAuth. Now I would like to verify that token on the server-side using PHP. Any idea?

I tried call https://oauth-login.cloud.huawei.com/oauth2/v3/tokeninfo with the param id_token=eyJhbGciOiJQUzI1NiIsImtpZCI6IXXX and it's returning the following error:

{
    "sub_error": 14004,
    "error_description": "",
    "error": 1400
}
  • may i confirm where is `id_token` obtained? From your example, this parameter is not in the correct format. – zhangxaochen Jan 14 '22 at 01:34
  • For some reason, the [error codes](https://developer.huawei.com/consumer/en/doc/development/HMSCore-References/server-error-codes-0000001062371380) feature neither of the given error codes. Please provide the PHP code which produces this error response, else it's quite difficult to answer. – Martin Zeitler Jan 17 '22 at 22:37

2 Answers2

1

Since the returned error code cannot be explained by the documentation ...
you may not be posting as content-type application/x-www-form-urlencoded;
most of the other API do require posting as application/json;charset=UTF-8.

I'm working on it, but don't have the that particular method implemented yet.
Maybe check within the next 1-2 weeks; I'm going to implement that anyway.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
0

Your ID Token looks quite a bit shorter than the example show in the documentation (2nd link) that has over 1000 characters. I recommend checking if your POST request was formatted correctly with the mandatory parameters and making sure your headers are correct.

Obtaining an Access Token https://developer.huawei.com/consumer/en/doc/development/HMSCore-References/account-obtain-token_hms_reference-0000001050048618 Once you have the correct ID token, here's the process to verify your token.

Verifying an ID Token https://developer.huawei.com/consumer/en/doc/development/HMSCore-References/account-verify-id-token_hms_reference-0000001050050577

Please share your PHP code and POST request so to help further if needed.

Zinna
  • 1,947
  • 2
  • 5
  • 20