WordPress.org

Ready to get started?Download WordPress

Forums

Safari Push
userID not saved in DB (5 posts)

  1. MuViMoTV
    Member
    Posted 7 months ago #

    I found something else that is not working quite as expected...

    The userID from WP is not saved into the DB on the push server...

    I tracked back and can see that the userID is set properly in the SafariPushParams

    But on the server side

    $userid = "";
    	foreach(apache_request_headers() as $header=>$value) { // this is the authorization key we packaged in the website.json pushPackage
    		if($header == "Authorization") {
    			$value = explode("_", $value);
    			if(isset($value[1]) && $value[1] >0) $userid = filter_var($value[1], FILTER_SANITIZE_NUMBER_INT);
    			break;
    		}
    	}

    There is no header named "Authorization"...

    I'm not exactly sure if the userID should be in there and the issue is coming from the plugin side not sending the info or the script on the push server not looking in the right place...

    Any idea what's going on there?

    Thanks

    http://wordpress.org/plugins/safari-push/

  2. MuViMoTV
    Member
    Posted 7 months ago #

    Ok well i figured that one out on my own :D

    The issue is not with the plugin or the push server per se...

    Adding the following to .htaccess solved the issue for me...

    RewriteEngine on
    RewriteCond %{HTTP:Authorization} ^(.*)
    RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
  3. macgamer
    Member
    Plugin Author

    Posted 7 months ago #

    The "Authorization" header is something Apple sends when requesting a key to be added. Are you sure you needed to make that change? It worked out of the box for me.

  4. MuViMoTV
    Member
    Posted 7 months ago #

    It was not working for me so i added a error_log to get the list of all the header and the Authorization was not in there...

    After about an hour of looking here and there i found this http://stackoverflow.com/questions/13387516/authorization-header-missing-in-django-rest-framework-is-apache-to-blame

    And other articles also commenting on the issue where this header is not passed to php

    After adding these lines to .htaccess the header just "magically" appeared and fixed the issue for me...

  5. macgamer
    Member
    Plugin Author

    Posted 7 months ago #

    Did you try WSGIPassAuthorization On instead?
    I'm a bit hesitant to change the htaccess like that because it might break something else.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.