That Google URL is generated in PostmanConfigTextHelper, line 85, it’s very simple code:
public function getCallbackUrl() {
// see https://codex.ww.wp.xz.cn/Function_Reference/admin_url#Related
return admin_url ( 'options-general.php' ) . '?page=postman';
}
The URL shown on the Configuration Screen and the URL injected into the HTTP post to Google should be identical, because they use the same call. I don’t know how it could change on the fly.
The config screen:
PostmanManageConfigurationAjaxHandler, line 206:
$response ['redirect_url'] = $scribe->getCallbackUrl ();
The POST to Google:
postmanAuthenticationManagerFactory, line 34:
$redirectUrl = $scribe->getCallbackUrl ();
If you enable the WordPress log and set the Postman Log Level to debug, there will be a better chance of pinpointing where it is getting lost. Specifically, check what Postman actually sent to Google. I’ve tested first-level subdomains before, chef.jasonhendriks.com and programmer.jasonhendriks.com.. but never second-level subdomains.
If your staging site has a dedicated IP address, you can trick Google by using a fake site name in your /etc/hosts file. That’s how I develop Postman on my laptop. See https://ww.wp.xz.cn/support/topic/cant-create-client-id-for-dedicated-ip-address?replies=4
Hi
Thanks for your response. I have configured logging as you suggest. The following is logged when I try and request permission from Google (anonymized slightly):
`03-May-2015 10:59:30 UTC] DEBUG PostmanWpMailBinder: Transport is not configured and ready
[03-May-2015 10:59:30 UTC] DEBUG Postman: Postman Smtp v1.5.13 starting
[03-May-2015 10:59:32 UTC] DEBUG PostmanWpMailBinder: Transport is not configured and ready
[03-May-2015 10:59:33 UTC] DEBUG Postman: Postman Smtp v1.5.13 starting
[03-May-2015 10:59:35 UTC] DEBUG PostmanAdminController: handling OAuth Permission request
[03-May-2015 10:59:35 UTC] DEBUG PostmanAuthenticationManagerFactory: Created PostmanGoogleAuthenticationManager
[03-May-2015 10:59:35 UTC] DEBUG PostmanGoogleAuthenticationManager: Requesting verification code from Google
[03-May-2015 10:59:35 UTC] DEBUG postman.php: Redirecting to ‘https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=http%3A%2F%2Fwww.mysite.com%2Fwp-admin%2Foptions-general.php%3Fpage%3Dpostman&client_id=<myclient id>&scope=https%3A%2F%2Fmail.google.com%2F&access_type=offline&approval_prompt=force&state=bdc5da918cfb48c78a462323550cf009&[email protected]’
So it does appear to be the case that the URI being sent to Google is different to the one that is being rendered on the Plugin configuration page / wizard, for what ever reason, presumably something to do with use of subdomains.
p.s. The staging site shares the same IP address as the main site….
Thanks
Just noticed that last logging line was truncated. I reads:
[03-May-2015 10:59:35 UTC] DEBUG postman.php: Redirecting to ‘https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=http%3A%2F%2Fwww.mysite.com%2Fwp-admin%2Foptions-general.php%3Fpage%3Dpostman&client_id=<myclient id>&scope=https%3A%2F%2Fmail.google.com%2F&access_type=offline&approval_prompt=force&state=bdc5da918cfb48c78a462323550cf009&[email protected]’
Oh – it wasn’t truncated I just had to scroll right – Oops!
I’ll try and reproduce it here.
I wasn’t able to reproduce it 🙁
Here is what I did:
In WordPress -> Settings -> General I put:
WordPress Address (URL) : http://www.staging1.mysite.com/~jasonhendriks/wordpress
Site Address (URL) : http://www.staging1.mysite.com/~jasonhendriks/wordpress
So this is the URL in the web browser for Postman’s main settings page:
http://www.staging1.mysite.com/~jasonhendriks/wordpress/wp-admin/options-general.php?page=postman
When I run configure, that is the same URL that Postman generates to display to you:
[03-May-2015 12:55:59 UTC] TRACE PostmanManageConfigurationAjaxHandler: Array
(
[dot_notation_url] =>
[redirect_url] => http://www.staging1.mysite.com/~jasonhendriks/wordpress/wp-admin/options-general.php?page=postman
[callback_domain] => http://www.staging1.mysite.com
And when I hit ‘Grant Permission from Google’ (Request permission in your version):
[03-May-2015 12:56:28 UTC] DEBUG PostmanAuthenticationManagerFactory: Created PostmanGoogleAuthenticationManager
[03-May-2015 12:56:28 UTC] DEBUG PostmanGoogleAuthenticationManager: Requesting verification code from Google
[03-May-2015 12:56:28 UTC] TRACE postman-common-wp-functions.php: Redirecting to 'https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=http%3A%2F%2Fwww.staging1.mysite.com%2F%7Ejasonhendriks%2Fwordpress%2Fwp-admin%2Foptions-general.php%3Fpage%3Dpostman&client_id=269589758857-vv59jgka2ghdoeic4r3kcapal57jdj3a.apps.googleusercontent.com&scope=https%3A%2F%2Fmail.google.com%2F&access_type=offline&approval_prompt=force&state=b591e574266b715f8fd7e7fd409604d7&[email protected]'
So I think our setups our the same (where it counts), but I still get the correct result. Why don’t you email me and I’ll try with your actual domain and see if it’s the same. Also you can try the latest version that I’m using but I doubt that will make a difference.
Hi,
Thanks very much for trying this. I agree that out setups looks the same, where it counts. I suspect that the issue is related to the siteground staging environment. I think I will just plough ahead and test on my live site.
Thanks again for you time and effort.
Marking as resolved since I don’t think that this is a plugin issue