Third Party Authentication using Huawei’s Auth Service - Huawei Developers

Auth Service provided by AppGallery Connect supports multiple third-party authentication modes such as HUAWEI ID, WeChat, QQ, Facebook and Twitter, covering most popular sign-in methods. Today we take a look at two issues that you might come up against when integrating the Auth service using a third party.
Result code:‭‭‭‭‭‭ 203817990‬ Error message: fail to get third user union id‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬​This error usually occurs when we integrate HUAWEI ID authentication. When we sign in to an app with a HUAWEI ID, Auth Service has to obtain the UnionID from the account. However, if you have not enabled the UnionID for your app, it will not be obtainable.
To enable the UnionID:
Sign in to HUAWEI Developers with your developer account.
Click Console and
go to App services > Development >HUAWEI ID.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Click Update in the Operation column for the app. Then select Enable for UnionID.
Error code: 203818033 Error message: google response aud not equal to appid​This error occurs when we integrate Google account authentication. This is because the value of the aud parameter carried by the ID token is not the same as the app’s ID in Google. According to the Google’s official documents, the value of aud should be equal to the app’s ID specified by Client ID on Google Cloud Platform.
The aud parameter is the client ID in the Google account management console.
To resolve this problem, configure the app’s client ID to Client ID when you enable Google authentication mode in AppGallery Connect.

Does it Use oAuth 2.0?

Useful Sharing, thanks!

Related

A Case Study of Resolving 403 Error During PMS API Call

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.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
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.
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.
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.
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

Resolving HTTP 502 Error During Leaderboard API Calls

Symptom:
When the getRankingIntent API is called, which is related to leaderboards, the following error message is displayed.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Log Information
The following error information is displayed in the Android Studio Logcat logs:
HTML:
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant W/HwGameAssistant-10.6.0.301-RequestHelper: client.assistant.gs.leaderboard.scores reponse fail code:502, msg:Bad Gateway
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant E/HwGameAssistant-10.6.0.301-GameRankingScoreListViewModel: getHttpStatusCode is : 502
Troubleshooting
The test result shows that the game sign-in function is normal. Therefore, the problem is not caused by a network error. After studying relevant documents, we checked the following items:
1. First, we ensured that the package name and app ID belong to the same game.
2. Then, we checked whether leaderboards have been created for the game in HUAWEI AppGallery Connect. It was found that leaderboards have been added for another game. We attempted to resolve the problem. However, testing shows that the problem still persists.
3. Finally, it was found that the account we used for testing is not on the list of test accounts in AppGallery Connect. After adding it to the list and clearing HMS Core (APK) cache on the phone, the problem is solved.
Summary:
If you find that the leaderboard function is abnormal, ensure that:
The app ID and the package name belong to the same game.
Your game has its leaderboard data created in AppGallery Connect.
Your test account has been added in AppGallery Connect.
For more details, check:
Adding a Leaderboard:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-add_leaderboard
Managing Tester Accounts:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-tester_account_mgt

Resolving HTTP 502 Error During Leaderboard API Calls

Symptom:
When the getRankingIntent API is called, which is related to leaderboards, the following error message is displayed.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Log Information
The following error information is displayed in the Android Studio Logcat logs:
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant W/HwGameAssistant-10.6.0.301-RequestHelper: client.assistant.gs.leaderboard.scores reponse fail code:502, msg:Bad Gateway
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant E/HwGameAssistant-10.6.0.301-GameRankingScoreListViewModel: getHttpStatusCode is : 502
Troubleshooting
The test result shows that the game sign-in function is normal. Therefore, the problem is not caused by a network error. After studying relevant documents, we checked the following items:
1. First, we ensured that the package name and app ID belong to the same game.
2. Then, we checked whether leaderboards have been created for the game in HUAWEI AppGallery Connect. It was found that leaderboards have been added for another game. We attempted to resolve the problem. However, testing shows that the problem still persists.
3. Finally, it was found that the account we used for testing is not on the list of test accounts in AppGallery Connect. After adding it to the list and clearing HMS Core (APK) cache on the phone, the problem is solved.
Summary:
If you find that the leaderboard function is abnormal, ensure that:
The app ID and the package name belong to the same game.
Your game has its leaderboard data created in AppGallery Connect.
Your test account has been added in AppGallery Connect.
For more details, check:
Adding a Leaderboard:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-add_leaderboard
Managing Tester Accounts:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-tester_account_mgt

What should I do when error code 60002 ("iap not activated") is reported and the payment page cannot be opened?

Problem:
I was testing in-app purchases for my app but the payment page failed to launch. The log information is as follows.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I checked the error code description in the official materials and found that it was because HUAWEI IAP wasn’t enabled. I checked the switch, and found that IAP has been enabled, but the problem persisted.
Analysis:
To resolve the problem, toggle on the IAP switch and configure IAP parameters, as shown in the following figures.
Document for enabling a service
2. If you used Android Studio to integrate the IAP SDK, download agconnect-services.json again by referring to the following figure and save the file to your app’s module directory of your project.
If you use Eclipse to integrate the SDK, check whether the appid and cpid parameters are correctly configured in the Manifest file.
Sample code:
XML:
<meta-data
android:name="com.huawei.hms.client.appid"
<!-- Replace xxx with the actual app ID, which can be obtained on the App information page. - ->
android:value="appid=xxx">
</meta-data>
<!-- Replace xxx with the actual payment ID, which can be obtained from the app's IAP information. -->
<meta-data
android:name="com.huawei.hms.client.cpid"
android:value="cpid=xxx">
</meta-data>
3. Once you have finished the preceding steps, if the problem still exists, wait for a while and try again, because there may be a one-hour delay due to cache issues.

Import Google In-app products using Huawei Conversion tool

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Article Introduction
In this article, we will show how import your In-app products from Google Play Console to AppGallery Product management, this will help you to focus on the integration process and facilitate the migration process.
Google File Conversion Tool
This conversion tool provide by HUAWEI AppGallery Connect that will help the developer to quickly reuse in-app product information from Google Play to AppGallery Connect, improving the efficiency of file format and price conversion.
Pre-Requisites
Export your products information from Google play.
Download the Conversion Tool.
Lets Start
My Products information from Google play.
Unzip the Conversion Tool.zip and open Conversion Tool.xlsm .
Click “Enable Content” to let the macros work.
Import your Google products CSV.
Select your“Base price countries”
Click Export!
Conclusion
Conversion tool will facilitate and help the developers to reuse their Google InApp Products, but there are more cases need to be covered such as if the developer want to support multiple currencies and multiple exchange rate.
Tips and Tricks
This tool helps convert only Google files but does not ensure the accuracy of currencies in the Google file and price conversion. So you need to confirm all the converted prices.
The converted price will be rounded up to two decimal places or the nearest integer.
You need to manually enter the product information in the ProductType column
References
Official page of the Conversion tool:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-help-conversion-tool-0000001164315135
Thank you all.
Original Source

Categories

Resources