I’m working on an Ionic React App running on top of Capacitor. It works fine with axios requests in browser, but on Android I have CORS issues, that’s why I’m using the community HTTP plugin: GitHub - capacitor-community/http: Community plugin for native HTTP
I click for example on my Login button. My data such as email and password are supposed to be sent via HTTP post, but it catches the error I have put there: Try again’ .
Do you have any idea why it might happen?
No error logs regarding the request on Android Studio either. Only these:
/system_process E/ClipboardService: Denying clipboard access to com.google.android.googlequicksearchbox, application is not in focus nor is it a system service for user 0
E/netmgr: qemu_pipe_open_ns:62: Could not connect to the ‘pipe:qemud:network’ service: Invalid argument
E/netmgr: Failed to open QEMU pipe ‘qemud:network’: Invalid argument
E/wifi_forwarder: qemu_pipe_open_ns:62: Could not connect to the ‘pipe:qemud:wififorward’ service: Invalid argument
E/wifi_forwarder: RemoteConnection failed to initialize: RemoteConnection failed to open pipe
To solve these errors I have added this setting inside application element:
android:usesCleartextTraffic=“true”
but the errors still occur.
Login function:
const doLogin = async (e: any) => {
e.preventDefault(); const loginData = { email: eMail, password: password, }; //https://github.com/capacitor-community/http const options = { url: "https://xx/login, data: loginData, }; const response: HttpResponse = await Http.post(options) .then((response) => { if (response.data.token) { history.push("/home"); window.location.reload(); } return response.data; }) .catch((error) => { setMessage( "Try again!" ); }); };
I’m stuck with this issue since 3 days so any help would be really really appreciated. Thank you!
1 post - 1 participant