Can't send notification [error: 80300002] (HMS Core Push Kit) - Web App - huawei-mobile-services

I have a web app project that sends out push notifications to phone browsers. I have successfully retrieved push token from my Huawei device but couldn't send notification through HMS Push Kit from my server, got an HTTP 401 and the error body contained:
{
"msg": "No permission to send message to these tmIDs",
"code": 80300002
}
I've contacted the customer service and was pointed to the following URL, I did everything listed there but still get the same error.
https://developer.huawei.com/consumer/jp/doc/development/HMSCore-Guides-V5/commonerror-0000001059816656-V5
This is the URL (POST) that returned the error (sent from my server, using app ID from project settings):
https://push-api.cloud.huawei.com/v1/my_app_id_from_project_settings/topic:subscribe
Access token was retrieved from the following URL using OAuth 2.0 Client ID/Secret from the console ("Credentials"):
https://oauth-login.cloud.huawei.com/oauth2/v3/token
I've also applied for HUAWEI ID from the console (App Services > Development > HUAWEI ID, using the same OAuth 2.0 Client ID/secret).
What I did for troubleshoot:
Push Kit Enabled (both Console level and Project level)
Access token with backslash (\) removed and URL-encoded
Server Location: Singapore (Push Kit disabled and re-enabled as advised)
POST request body with a JSON body with only 2 properties topic (string) and tokenArray (string array, e.g. ["token1", "token2"])
POST request headers with Authorization: Bearer <access_token>
POST request headers with Content-Type: application/json
Debug using "Cloud Debugging" feature.
Tested on emulator running Android 11 (API-level 30, HMS Core 5.0.3.304)
Tested on my Huawei device running EMUI 8.0 (with Google Play Services)
Tested on Android Chrome 87 (device), Android Chrome 83 (emulator)

Please create an Android application under the project of the web application, and obtain the access_token with the appid and appsecret of the Android app. Then the access_token can be passed into the send interface.

Related

I needed to access HUAWEI AppGallery Connect API and create a product through the PMS API (server API). But 403 client token authorization fail

Recently,I 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.
how can i fix it?
Based on the error code included in your screen captures, the error was caused by an authentication failure.
To solve the problem, you first need to confirm that the client ID used for applying for the token has sufficient permission.
HMS official document suggested that the project associated with the API client be selected as N/A. You need to create an API client and associate it with a project. E.g. An app ID in the project was 100xxx591. However, the app ID in the Postman service request was 101xxx531, which would cause the authentication failure.
Also, to fix the above, you need to create an API client and selected N/A (indicating that all projects are supported), and use the client to request a token. The process should work well after this.
In general, if Huawei's 403 authentication failure occurs, you can verify the permission first, and then check the associated projects.
For more details about the PMS API, please refer to this link.

UWP Device Portal app deployment Forbidden: CSRF Token Invalid

I am trying to deploy an application to a hololens with the Windows device Portal Rest API.
For some reasons I don't want to use the Microsoft Device portal wrapper.
In C#, with RestSharp, I can get the list of installed packages but when I try to deploy a new app, I get the error Forbidden because of CSRF token invalid.
Then I tried to add cookies from the previous request but I still get this error.
I tried to do the same with Postman but I have a different error: 413 Payload too large. The msix file is 154 MB but I have no problem to deploy it with the web device portal.
Thank you for your help.
[EDIT] I tried a smaller app on Postman and I get 403 CSRF token invalid
After analyzing the web device portal with wireshark I found that it is using a parameter with the name "X-CSRF-Token" while adding a cookie add the parameter "CSRF-Token".
Manually adding this parameter with the right value did the trick.

Account kit SMS verification is returning "NOT_AUTHENTICATED" response status on my web page

I have tested account kit sms verification on my local server and everything went right but when I push the editings on my remote server it starts to return "NOT_AUTHENTICATED" to the page in response.startus.
I have tried to use APP key and secret, that I use normally on remote server, on my local server to test if it was a problem of api version (indeed on my local I use a Facebook APP with 2.5 version and on server I use a Facebook APP with 2.2 version) but everything went right on my local server and I get the right response.status.
When I insert the sms verification code on account kit popup it told me that the number it's verified but when it closes itself I get response.status = NOT_AUTHENTICATED.

Response is Unauthorize 401 while connecting to quickbook api when tokens are valid

I am using firefox rest client to make a rest request to quickbook api.
below are fields I am using :
URL : https://quickbooks.api.intuit.com/v3/company/companyId/vendor/2
Method : POST
Header : Content-Type : application/xml
OAuth :
Consumer key : ****
consumer secret : ****
Access Token : ****
Access token secret : ****
I am copying these tokens directly from https://appcenter.intuit.com/Playground/OAuth/IA
Strange part is when these tokens are used in data service of IPP V3 Java Devkit, these token works.
I have no idea why these tokens will work with data service devkit and not on rest client.
Please help. Stuck on this from last 4 days.
Why do need the rest client for? The Oauth tokens geenrated by Intuit are known to have issues with Rest Clients. That's why we have provided the API explorer to test realms-
https://developer.intuit.com/apiexplorer?apiname=V3QBO
You just need to select your company/realm there.
OR
to debug client issues, there is another OAUTH extension provided by Intuit for Fiddler2.
Fiddler2-http://fiddler.en.lo4d.com/
Extension for OAUTH 1.1-
https://github.com/IntuitPartnerPlatform/FiddlerOAuth
1) Copy the extension to ‘My Documents\Fiddler2\Scripts’ folder.
2) You will then see the OAuth settings tab when you open the fiddler client.
3) Generate the Token and Token Secret using
Developer playground -
Login into developer.intuit.com->Manage my apps->Test connect
or
Use one of the sample apps from here-
https://github.com/IntuitDeveloperRelations/
4) Add the keys generated from step above in the OAuth setting tab, and click Apply.
5) You can fire your requests using Composer tab.
6) Add the correct headers after verifying from API explorer and then Run.
7) You can then view the raw response on the right side of the tab and the status code for the response on the left side.

Facebook Login on Meteor works on Chrome only

I'm facing with an issue using Facebook Login in Meteor. It seems to work correctly with Chrome (desktop) only.
I'm in a localhost:3000 environment, I set up Facebook App in the right way, I saved App Id and App Secret in the Accounts.loginServiceConfiguration.insert(); server-side, Login button appears correctly but... It only works on Chrome (desktop).
Using Firefox, Safari and mobile browsers like Chrome or Safari for iOS, this is what my server console produces in output:
Exception while invoking method 'login' Error: Failed to complete OAuth handshake with Facebook. failed [400] {"error":{"message":"Invalid verification code format.","type":"OAuthException","code":100}}
at getTokenResponse (app/packages/accounts-facebook/facebook_server.js:71:11)
at Object.handleOauthRequest (app/packages/accounts-facebook/facebook_server.js:17:18)
at Object.Accounts.oauth2._handleRequest (app/packages/accounts-oauth2-helper/oauth2_server.js:9:31)
at Object.Accounts.oauth._middleware (app/packages/accounts-oauth-helper/oauth_server.js:122:23)
at app/packages/accounts-oauth-helper/oauth_server.js:95:22
I cleaned the cache too but without any result.
"Internal server error" and a button "Dismiss" is the output.