Page 1 of 1

custom app external api response not working

Posted: 14 Sep 2022, 09:34
by miami1983
Hi ,
we build custom app to integrate with API server for : user need to enter his mobile number , the API server will get the user response , check his balance and recharge his hsnm user

but using the API url inside the custom app , not provide us the response as normal using in browser

the error we observe :
from origin 'http://wifi.ps' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.

after set no-cors in the custom app .. the API integration working and recieve transaction to external server , but without response

method: 'GET',
cache: 'no-cache',
mode: 'no-cors',

and the response are : "failed to load response data : NO data found for given resource with given identifier "

how we can solve it while we try all things :

Re: custom app external api response not working

Posted: 14 Sep 2022, 11:16
by HSNMSupport
Hi
If calling the API through a web browser it works but it didn't work on your APP, it means that there was something wrong on your APP
In addition to that, the error your provided (".... 'http://wifi.ps' has been blocked by CORS policy: Response to preflight request doesn't pass access control check:....") is not an error provided by our system

Best regards

Re: custom app external api response not working

Posted: 25 Sep 2022, 14:05
by miami1983
Hi
If calling the API through a web browser it works but it didn't work on your APP, it means that there was something wrong on your APP
In addition to that, the error your provided (".... 'http://wifi.ps' has been blocked by CORS policy: Response to preflight request doesn't pass access control check:....") is not an error provided by our system

Best regards
can you help me how i can solve it .. i try all of choices

Re: custom app external api response not working

Posted: 26 Sep 2022, 09:16
by HSNMSupport
It is not possible for us, to give you support on your platforms.
S.T.

Re: custom app external api response not working

Posted: 12 Dec 2022, 14:30
by miami1983
It is not possible for us, to give you support on your platforms.
S.T.
i change the method by using error cause code 200 for OK and 500 for error
but when inspect the result over HSNM hotspot portal login for custom app , its detect the response from console as 0 all the time

and not detect the network error i send ..

just to understand the scenario . i have ASP.net IIS API server working with all normal browsers and API servers connected to multi supplier .. the problem only on your system which i need to integrate it with mobile operator

the API link provided from my API server is working and can doing charging systems ,, but when using on custom app and try to catch the response we can't have it

Re: custom app external api response not working

Posted: 12 Dec 2022, 14:35
by HSNMSupport
We have documentation for Integrations with HSNM.
We do no give support for .NET.
Please check your own code.
S.T.

Re: custom app external api response not working

Posted: 14 Dec 2022, 13:07
by miami1983
We have documentation for Integrations with HSNM.
We do no give support for .NET.
Please check your own code.
S.T.
I use php API server with the same error .. i can't read the response in the console it give me "null" in the body

so we need help

Re: custom app external api response not working

Posted: 09 Jan 2023, 17:02
by HSNMSupport
The problem has been solved.
This issue was caused by a wrong configuration of the server hosting the API called.
They added the right CORS policy and the remote call from the HSNM app started working.
S.T.