Reply To: IOS Cannot log-in and doesnt load couses

#46876

ben
Participant

Thanks for that Scott! All working now.

To anyone else trying to find a fix for this:

It was a mixture of errors, although the app worked in previous builds, since updating the app files it seems to pull requests from the site in different ways. I updated my config.xml with the additional access origin parameters that I missed out, provided by the vibe guys,

  • <access origin=”*://*/*” />
  • <access origin=”file:///*” />
  • <access origin=”cdvfile://*” />

After which I got more of a response and a different set of errors when inspecting the IOS simulator in safari! So I rechecked my site and removed all of the Access-Control-Allow-Origin ”*” snippets I may have added in .htaccess or wplms-customiser plugin etc.

In the end I added the following function to my functions.php along with SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0 in my .htacess.

function my_customize_rest_cors() {
remove_filter( ‘rest_pre_serve_request’, ‘rest_send_cors_headers’ );
add_filter( ‘rest_pre_serve_request’, function( $value ) {
header( ‘Access-Control-Allow-Origin: *’ );
header( ‘Access-Control-Allow-Methods: GET,HEAD,OPTIONS,POST,PUT’ );
header( ‘Access-Control-Allow-Credentials: true’ );
header( ‘Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization’ );
header( ‘Access-Control-Expose-Headers: Link’, false );
return $value;
} ); }
add_action( ‘rest_api_init’, ‘my_customize_rest_cors’, 15 );

 

And it worked!!! Just a reminder to make sure your using your child theme!

Thank you Scott & Harry for your help.