I have a react native project where i am sending a http request through fetch() to a page that redirects me to a url scheme like appname://data=123456.
I need to extract those data from the location url and then continue with other requests to a api. The problem is that ios has problems with this. Android chomps it righ up and it works without problems, but on ios i get a "Network request failed" result.
After some longer debugging i found out that the implementation behind react native catches a error stating "unsupported URL".
Is there any way to make this work? I was trying something along the lines of starting up an app with custom URL scheme, and now appname:// written into safari starts up my app, but it had no effect for the request.
Code i am using for the request: OAUTH2_IS_URL is https://login.server.com and action /api/login
const postData = {username, password};
return fetch(BuildConfig.OAUTH2_IS_URL + action, {
method: 'POST',
credentials: 'same-origin',
mode: 'same-origin',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: Object.keys(postData).map(key => key + "=" +
encodeURIComponent(postData[key])).join('&')
});