• Resolved JoeJohnson

    (@joejohnson)


    Hi,

    The issue I’m having seems similar to this resolved ticket:
    https://wordpress.org/support/topic/cant-authorize-google-photos/

    However, in my case I have the right Client_ID and Client_Secret configured in the Google API settings as well as the redirect URL of:
    https://www.belparktri.ie/wp-admin/admin.php?page=photonic-auth

    When I try to authenticate (Photonic -> Authentication -> Google Photos -> Authenticate) it correctly takes me to an account selection. After selecting the correct account I get the error “This app isn’t verified” even though I received confirmation from Google that my project is verified:
    “Your project silver-catwalk-221417 has been successfully verified.”

    I can continue on to the site anyway (by clicking ‘Advanced’) to the page asking “Photonic wants to access your Google Account”. Clicking on the “Allow” button then results in a “406 Not Acceptable” error. I’m on a Mac using Safari but I get the same results using Chrome as well.

    Couple of things to note:
    * if I try to use the redirect URL specified in the plugin and docs that contains “&source=google” at the end, then if fails straight away with redirect_uri_mismatch saying the URLs don’t match. So I’ve take that parameter away.
    * I noticed in the docs that you use “Photonic WordPress Plugin” as the application name in the OAuth Consent screen. I am just using “Photonic”. I don’t imagine this makes much difference since I believe it’s just used to show the user which app is requesting access.

    Is there anything else I can try?

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Sayontan Sinha

    (@sayontan)

    Thank you for the very detailed description.

    Apologies for not responding earlier: this is a genuine head-scratcher, and I don’t have an immediate solution for you. This is the first time I have come across the set of problems that you have listed. Are you using the latest version of the plugin (2.02)? Is there any other plugin you have that deals with Google authentication? Is there any effect if you disable such a plugin?

    The first thing that is a bit puzzling is the redirect_uri_mismatch, because the source=google is hardcoded into the link in the “Authenticate” button, so there shouldn’t be a mismatch between URLs. If you right-click on the “Authenticate” button and copy the URL, do you see source=google as a part of the redirect_uri parameter?

    This is not on my documentation (because I have never needed to do this), however, can you confirm if following the steps here helps?

    Also, while populating the client ID and secret can you make sure that you are pasting plain-text (copying the codes from Google to a text editor, and then copying from the text editor into Photonic), and without any leading / trailing spaces or tabs?

    Lastly, do you have another site you can try this on? E.g. a local development environment?

    Thread Starter JoeJohnson

    (@joejohnson)

    Hi Sayontan,

    Thanks for your prompt reply. You are correct that the actual link behind the Authentication button contains the ‘source=google’ parameter, but that is somehow stripped away by Google when they respond to the request. The link I’m now using is:

    https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=1044091329129-hgj5ui34tbmkvrfip686ngv2r9a33o08.apps.googleusercontent.com&prompt=consent&redirect_uri=https%3A%2F%2Fwww.belparktri.ie%2Fwp-admin%2Fadmin.php%3Fpage%3Dphotonic-auth%26source%3Dgoogle&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fphotoslibrary.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fphotoslibrary.sharing%20https%3A%2F%2Fpicasaweb.google.com%2Fdata%2F&state=d7bce37caf479dabe4bb81add7a70639%3A%3A%252Fwp-admin%252Fadmin.php%253Fpage%253Dphotonic-auth%2526ip-geo-block-auth-nonce%253Dcd867db65f

    Again though, if I configure the “source=google” parameter in my OAuth consent screen redirect URL, then if fails straight away with redirect_uri_mismatch.
    Take it away, and it seems to get one step further.

    Then, once I select the email account and click on ‘Allow’, if fails with 406.

    I will try using a different website and will let you know if anything changes.

    Thanks again,
    Joe

    Thread Starter JoeJohnson

    (@joejohnson)

    Hi again,

    I’ve just tried adding the “source=google” to my redirect URL and using a different system with Photonic installed to test.
    This time it did not raise a redirect_mismatch error but had the same result of complaining about the App not being verified after trying to allow access.

    I’ve removed and reinstalled Photonic (2.0.2) and have used the exact same client credentials from the other system, and still I get a redirect_mismatch error.

    It appears that something in my primary system may be causing a conflict with your plugin, but I’ve tried disabling all but the most essential plugins without any improvement.
    Are you aware of any type of plugin that might cause problems?

    Note that, even if I solved the plugin conflict problem, it still fails to correctly authenticate. That’s the current status on the test system..

    Many thanks and I appreciate any ideas you have.

    Regards,
    Joe

    Plugin Author Sayontan Sinha

    (@sayontan)

    One thing I noticed is that you have an additional parameter ip-geo-block-auth-nonce at the end of your URL – that is definitely not from Photonic; maybe consider deactivating that plugin before you authenticate and reactivate it once you have obtained the token. That is likely to help with the redirect URL issue. (BTW, you can add both redirect URLs to your Google Project configuration, but that will merely bypass the redirect issue, not resolve it).

    Regarding App Verification and the subsequent 406 failure, my guess is that those may be interconnected. In your app definition, do you have your current domain listed under the “Authorized domains”?

    I also found this link while investigating 406 failures. This leads me to think that there might be another plugin that is explicitly setting an Accept- header. IMO, one thing to try would be basically block off any other plugins for now, attempt the process, and then once complete, reactivate the other plugins.

    Thread Starter JoeJohnson

    (@joejohnson)

    Yes, I can confirm that IP Geo Block is the plugin causing the redirect_uri_mismatch error. The plugin link is:
    https://wordpress.org/plugins/ip-geo-block/

    Now when that plugin is disabled, it correctly goes to the “Choose an Account” page from Google but gives the same “App is not verified” error.

    Did a bit more research regarding app verification and I’m wondering if we may be talking about two different things. I have verified my domain (installed a downloaded html file from Google to my site) and I have also verified my OAuth Consent screen. I requested this from the consent screen itself.

    However, there is another form called “OAuth Developer Verification Form” at the following link:
    https://support.google.com/code/contact/oauth_app_verification
    I have complete this but it has not yet been approved/verified.

    Could this Developer Verification Form be the reason my ‘app’ is not verified?

    Thanks again as always..

    Plugin Author Sayontan Sinha

    (@sayontan)

    Quoting from the link you pasted:

    Don’t submit a review request if any of the following applies to you:

    • You’ll only request OAuth tokens for your own accounts and not from external users.
    • You’re using the app to send emails through WordPress plugins or similar single-account SMTP usage.
    • Non-Apps Scripts Web Clients: If the users of your project belong to the same G Suite domain, and the project is associated with a Cloud Organization.
    • Apps Scripts: If the owner and users of your Apps Scripts belong to the same G Suite domain or customer.

    Unless you are doing it for a different account you should be fine and not require verification.

    So at this point is Photonic the only plugin you have active? I am out of ideas if Photonic is the only thing you have active.

    I do have a workaround though:

    1. Go to the Google OAuth2 Playground.
    2. On the right, under the configuration select the option to “Use your own OAuth credentials”. Provide your client ID and secret there.
    3. On the left, under “Step 1 Select & authorize APIs” in the box next to “Authorize APIs”, put in https://www.googleapis.com/auth/photoslibrary.readonly https://www.googleapis.com/auth/photoslibrary.sharing https://picasaweb.google.com/data/, then click “Authorize APIs”.
    4. You will go through the authentication screens, and finally, the section under “Step 2 Exchange authorization code for tokens” gets activated. You will see an “Authorization code” populated, and you can “Exchange Authorization code for tokens”
    5. That will get you the “Refresh token” and the “Access token”. Copy the “Refresh token” and save it under Photonic → Settings → Google Photos → Google Photos settings → Refresh Token (for Back-end / Server-side Authentication).

    Once you save the settings you may be able to proceed with actually using the plugin.

    Thread Starter JoeJohnson

    (@joejohnson)

    You sir are a genius. That workaround worked perfectly and I am now using Photonic with Google Photos. You get five stars from me.

    All that remains is for me to thank you very much for all you help and prompt replies. It was a real pleasure working through this with you and I wish you great success with your plugin – which is fantastic by the way..!

    All the best,
    Joe

    Plugin Author Sayontan Sinha

    (@sayontan)

    Great… very happy to hear that you were finally able to get it working. Do let me know if you run into any other issue.

    I am marking this thread resolved.

    I just had the same issue, and wow, this last fix worked perfectly Sayontan! Thanks!

    Greetings, Still jammed. I followed 5-step workaround and got blocked at step 3. Google is telling me:

    400. That’s an error.
    Error: redirect_uri_mismatch
    The redirect URI in the request, https://developers.google.com/oauthplayground, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com…

    In step 3, I am copying/pasting the URLs exactly as you have typed them in the post, with a single space between each URL, correct?

    Next, I’m using the following redirect URI (with my own DOMAIN-NAME)
    http://DOMAIN-NAME/wp-admin/admin.php?page=photonic-auth

    Instead, does it need to be these two, as indicated in the WP Photonic Settings information:

    http://DOMAIN-NAME
    http://DOMAIN-NAME/wp-admin/admin.php?page=photonic-auth&source=google

    Thank you

    Plugin Author Sayontan Sinha

    (@sayontan)

    See my comment here: https://wordpress.org/support/topic/error-403-upon-authentication/#post-10939428.

    Also, this is a “resolved” thread, and generally not monitored; it might help to start your own thread.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Can’t authorize Google Photos’ is closed to new replies.