• Resolved lxndrskv

    (@lxndrskv)


    Whenever I try to request permission from Google, it brings me to a ‘404 Not Found’ page.

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Jason Hendriks

    (@jasonhendriks)

    Thanks for the bug report. Sorry the plugin is not working for you. I imagine this error should be easy to fix, though I haven’t seen anything like that in my work on the plugin (yet).

    Please copy the address in your browser’s address bar and paste it here. I’d like to see what URL your browser is trying to load that leads it to 404.

    Thread Starter lxndrskv

    (@lxndrskv)

    Plugin Author Jason Hendriks

    (@jasonhendriks)

    There is something peculiar about your environment. The code that redirects to Google writes a Location: header into the HTTP Response and then calls exit() to let your browser take over. But your URL, instead of pointing to google.com, points to your own website (the https://*******.tk/o/oauth2/ part).

    I’m betting you have an Apache mod like mod_rewrite doing something unexpected to the response headers. Shall we chat over e-mail for privacy?

    Thread Starter lxndrskv

    (@lxndrskv)

    It’s alright, we can keep this conversation public as long as I don’t show any URLs.

    It is right that I have a peculiar environment. Rather than the Apache server facing the internet on port 80, I have an IIS server rewriting all of the traffic to the WordPress site.

    Edit: I also just performed a test install of your plugin on another instance and was able to authorise Google.

    Plugin Author Jason Hendriks

    (@jasonhendriks)

    Alright, security by obscurity ??

    I have two fixes in mind to try, the first is to use the wp_redirect function instead of writing the header myself, but when I checked the source code of wp_redirect, it looks like they do nearly the same thing.

    My second idea is to write a META tag or Javascript redirect in HTML to slip by your IIS rewrites. It’s a little “Bull in a China Shop” but it may be the only solution.

    I’ll post a patched .zip for you to try when I finish the fix.

    Plugin Author Jason Hendriks

    (@jasonhendriks)

    Is your IIS misconfigured? As a reverse proxy, it should only be re-writing internal links. For example, links to https://local-server/ should be re-written as https://*******.tk/. It should leave external links unmodified.

    Thread Starter lxndrskv

    (@lxndrskv)

    I spoke to the the guy who manages the front-end. He told me it should be working.

    Plugin Author Jason Hendriks

    (@jasonhendriks)

    Ya. The admin guys always say that don’t they? ?? But clearly it’s not working.

    Ask your guy if he will set the IIS ARR option

    reverseRewriteHostInResponseHeaders to false

    as per Problem with Location response headers with ARR and URL Rewrite Reverse Proxy and BUG: “Reverse rewrite host” replaces all cookie domains.

    If he/she says no, I will make the fix, but I would prefer not to. It’s a dirty hack for something that’s probably a one-off configuration error.

    Thread Starter lxndrskv

    (@lxndrskv)

    So, I talked to the admin and apparently he didn’t know what he was talking about. I showed him what to do, as per those forum posts, and now it works!

    Sort of. Instead of getting stuck on the 404 screen, it now sends me to the Google authorisation page. However, once I click accept, it sends me to a blank page with https://******.tk/wp-admin/options-general.php?page=postman&code=4/3asOLsLhwlo5R9UQ9gkQaWaIM4M-Q8MRPQUK1dQVfdk.gqMLEwkc85oc3oEBd8DOtNDpI-DhlgI as the URL. Refreshing the page brings me back to the Postman settings panel with the same warning asking to get permission from Google.

    Edit: I also tried the same thing with Microsoft, but I saw no change.

    Plugin Author Jason Hendriks

    (@jasonhendriks)

    Ok, well better than we were this afternoon ??

    Edit: I’m trying to wrap my head around what re-writes happen when Google redirects back to your site, and my brain is twisting. A blank screen generally indicates a PHP crash.

    Edit: The reason refreshing the page does nothing with the returned code in the URL from Google is that I remove the Session Key by that point, ignoring the code, so we don’t get stuck in an infinite loop in cases where there is a problem (like this).

    Are you willing to turn on debug mode for your site? Unfortunately it is difficult for me to know what’s going on, not having your environment to play with.

    Debug mode is enabled in wp-config.php

    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);

    Which will create the file wordpress/wp-content/debug.log

    I’m looking for something like this:

    [10-Feb-2015 01:19:22 UTC] DEBUG PostmanWpMailBinder: Not attemping to bind, plugin is not configured.
    [10-Feb-2015 01:19:22 UTC] DEBUG PostmanAdminController: Got Get action oauth_request_permission
    [10-Feb-2015 01:19:22 UTC] DEBUG PostmanAuthenticationManagerFactory: Created PostmanGmailAuthenticationManager
    [10-Feb-2015 01:19:22 UTC] DEBUG PostmanGmailAuthenticationManager: authenticating with google: loginHint=********@hendriks.ca
    [10-Feb-2015 01:19:28 UTC] DEBUG PostmanWpMailBinder: Not attemping to bind, plugin is not configured.
    [10-Feb-2015 01:19:28 UTC] DEBUG postman.php: Authorization in progress
    [10-Feb-2015 01:19:28 UTC] DEBUG PostmanAuthenticationManagerFactory: Created PostmanGmailAuthenticationManager
    [10-Feb-2015 01:19:28 UTC] DEBUG PostmanGmailAuthenticationManager: Found authorization code in request header
    [10-Feb-2015 01:19:28 UTC] DEBUG PostmanGmailAuthenticationManager: Updating Access Token Expiry Time
    [10-Feb-2015 01:19:28 UTC] DEBUG PostmanGmailAuthenticationManager: Updating Access Token
    [10-Feb-2015 01:19:28 UTC] DEBUG PostmanGmailAuthenticationManager: Updating Refresh Token
    [10-Feb-2015 01:19:28 UTC] DEBUG postman.php: Authorization successful
    [10-Feb-2015 01:19:29 UTC] DEBUG PostmanWpMailBinder: Binding to wp_mail()
    Thread Starter lxndrskv

    (@lxndrskv)

    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitizing data before storage
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Encryption Type ssl
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Hostname smtp.gmail.com
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Port 465
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Authorization Type oauth2
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Sender Name *********-NoReply
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Client ID 365997841403-b0u4s3v03ol81ul176fpq6mmbh9kp4j7.apps.googleusercontent.com
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Client Secret ************************
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Username
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Password
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Sender Email *************@gmail.com
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Validation Success
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitizing data before storage
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Encryption Type ssl
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Hostname smtp.gmail.com
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Port 465
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Authorization Type oauth2
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Sender Name **********-NoReply
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Client ID 365997841403-b0u4s3v03ol81ul176fpq6mmbh9kp4j7.apps.googleusercontent.com
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Client Secret ************************
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Username
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Password
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Sanitize Sender Email ************@gmail.com
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanWpMailBinder: Not attemping to bind, plugin is not configured.
    [10-Feb-2015 01:48:40 UTC] DEBUG PostmanAdminController: Got Session action save_success
    [10-Feb-2015 01:48:44 UTC] DEBUG PostmanWpMailBinder: Not attemping to bind, plugin is not configured.
    [10-Feb-2015 01:48:44 UTC] DEBUG PostmanAdminController: Got Get action oauth_request_permission
    [10-Feb-2015 01:48:44 UTC] DEBUG PostmanAuthenticationManagerFactory: Created PostmanGmailAuthenticationManager
    [10-Feb-2015 01:48:44 UTC] DEBUG PostmanGmailAuthenticationManager: authenticating with google: loginHint=************@gmail.com
    [10-Feb-2015 01:48:47 UTC] DEBUG PostmanWpMailBinder: Not attemping to bind, plugin is not configured.
    [10-Feb-2015 01:48:47 UTC] DEBUG postman.php: Authorization in progress
    [10-Feb-2015 01:48:47 UTC] DEBUG PostmanAuthenticationManagerFactory: Created PostmanGmailAuthenticationManager
    [10-Feb-2015 01:48:47 UTC] DEBUG PostmanGmailAuthenticationManager: Found authorization code in request header
    [10-Feb-2015 01:48:47 UTC] PHP Fatal error:  Class 'Google_IO_Stream' not found in /var/www/html/wp-content/plugins/postman-smtp/Postman/Postman-Auth/google-api-php-client-1.1.2/src/Google/Client.php on line 600

    That’s that best I could do. My office already shutoff the development VMs (stupid protocol), so I think I am done for the night.

    I’d like to thank you very much for all the help you have provided. I’m quite sure no other plugin developer would have bothered through this. ??

    Plugin Author Jason Hendriks

    (@jasonhendriks)

    Well, we found the new problem anyway. The very last line.

    PHP Fatal error: Class 'Google_IO_Stream' not found in /var/www/html/wp-content/plugins/postman-smtp/Postman/Postman-Auth/google-api-php-client-1.1.2/src/Google/Client.php on line 600

    I’ll have some new code for you tomorrow… you’ve evidently triggered a Google error I’ve never seen before ??

    You’re welcome.. it’s a two-way street. I appreciate you taking the time to help me iron out the problems in the plugin. I want it to be the best that i can be!

    Plugin Author Jason Hendriks

    (@jasonhendriks)

    Ok, I added the Google file Stream.php to fix the last error you got. I might just pull that whole Google library out, I’ve been meaning to anyway..

    I also added lots of debugging around the request permission from google code, added a catch-all error handler so no more white screens of death, AND I changed all the Location: headers that are internal redirects to relative paths.. which means they should not need to be re-written in order to work with your reverse proxy setup.

    Please download the trunk file, install it, and see if you can get your auth token now, or at least a proper error message.

    Hello! Version 1.3.1 resolve the error “PHP Fatal error: Class ‘Google_IO_Stream’ not found in /var/www/html/wp-content/plugins/postman-smtp/Postman/Postman-Auth/google-api-php-client-1.1.2/src/Google/Client.php on line 600”, now all are OK. Thank you!!

    Thread Starter lxndrskv

    (@lxndrskv)

    Version 1.3.1 also fixed my problem. Thanks Jason!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘404 Not Found’ is closed to new replies.