React native axios ios not authenticating against apache/php React native axios ios not authenticating against apache/php apache apache

React native axios ios not authenticating against apache/php


Turns out it was a trailing slash required on the request for IOS. I was able to find this link https://github.com/square/retrofit/issues/1037 where the the issue was described as:

For those interested: We are using Django as our backend and by default when you do not provide a trailing slash on the endpoint Django redirects from the non-slash endpoint to the slash endpoint.

Now, we aren't using Django, but apparently for our configuration of Zend it was the same issue - Android was able to re-direct without issue, while IOS was not. Another comment on the task states:

OkHttp strips the "Authorization" header when redirected across hosts (connections) via a 3xx response from the original host.

Which doesn't seem accurate, since Android was using OkHttp and was working fine. It looked like IOS using Darwin had the issue.

EDIT I forgot something else from my original post, I also had to change my interceptor from the line config.headers.common.Authorization = ... to config.headers.Authorization = ... which for some reason kept the casing. Original way converted Authorization to authorization, while the latter kept it as Authorization. Not sure if this was an issue, but I made it anyhow.

// On login success, set the authInterceptor responsible for adding headersauthInterceptor = ServiceApi.interceptors.request.use((config) => {      console.log(`Attaching Authorization to header ${basicAuth}`);      config.headers.Authorization = basicAuth;      return config;    }, (error) => {      Promise.reject(error);    });