Unable to login with Google[Resolved]

I have installed Plone PAS plugin and enabled Google+ API in google console.

Still am unable to login with google external provider authentication.

Below is error trace back:

Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module Shared.DC.Scripts.Bindings, line 322, in call
Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
Module Products.CMFCore.FSPageTemplate, line 237, in _exec
Module Products.CMFCore.FSPageTemplate, line 177, in pt_render
Module Products.PageTemplates.PageTemplate, line 87, in pt_render
Module zope.pagetemplate.pagetemplate, line 132, in pt_render
Module five.pt.engine, line 98, in call
Module z3c.pt.pagetemplate, line 163, in render
Module chameleon.zpt.template, line 261, in render
Module chameleon.template, line 191, in render
Module chameleon.template, line 171, in render
Module 3d5c3fdb5924f4c4568c87457ce20105.py, line 451, in render
Module 142140945d987ba20c5d47e33c380e65.py, line 1223, in render_master
Module 142140945d987ba20c5d47e33c380e65.py, line 458, in render_content
Module 3d5c3fdb5924f4c4568c87457ce20105.py, line 430, in __fill_main
Module 775d56f295d0c8ec92bf75463ce78a33.py, line 142, in render_login_failed
Module five.pt.expressions, line 135, in call
Module five.pt.expressions, line 126, in traverse
Module zope.traversing.adapters, line 136, in traversePathElement

  • traceback_info: ({'args': ()}, 'state')
    Module zope.traversing.adapters, line 50, in traverse

  • traceback_info: ({'args': ()}, 'state', ('getErrors',))
    LocationError: ({'args': ()}, 'state')

  • Expression: "options/state/getErrors"

  • Filename: ... .egg/plone/app/openid/skins/ploneopenid/login_failed.cpt

  • Location: (line 23: col 23)

  • Source: errors options/state/getErrors;
    ^^^^^^^^^^^^^^^^^^^^^^^

  • Arguments: repeat: {...} (0)
    template: <ImplicitAcquisitionWrapper login_success at 0x7f475720ce60>
    modules: <instance - at 0x7f476192a7e8>
    here: <ImplicitAcquisitionWrapper meritsPlone at 0x7f47575a5af0>
    user: <ImplicitAcquisitionWrapper - at 0x7f475720c410>
    nothing: <NoneType - at 0x7f476be84f70>
    container: <ImplicitAcquisitionWrapper meritsPlone at 0x7f47575a5af0>
    default: <object - at 0x7f476c07fc30>
    request: <instance - at 0x7f47547ec998>
    wrapped_repeat: <SafeMapping - at 0x7f4754872418>
    traverse_subpath: <list - at 0x7f4754ae61b8>
    loop: {...} (0)
    context: <ImplicitAcquisitionWrapper meritsPlone at 0x7f47575a5af0>
    translate: <function translate at 0x7f4754a37b90>
    root: <ImplicitAcquisitionWrapper Zope at 0x7f47577120f0>
    options: {...} (1)
    target_language: <NoneType - at 0x7f476be84f70>

Please someone help me to fix this as early as possible.

Errm, I have no clue about Plone PAS plugin, but is Google+ really still compatible with OpenID ? I seem to dimly remember that Google use OAuth these days...

https://developers.google.com/identity/protocols/OpenID2Migration

Something like this

may be more what you are searching for. It does not seem to be compatible OAuth 2.0 though.

Which plugin did you install, and in which version of Plone? Could you provide your buildout.cfg?

Plone==5.0.8
Authomatic = 0.1.0.post1
oauthlib = 2.0.6
pas.plugins.authomatic = 1.0b1

I don't think you need OpenID for Google authentication to work, so I'd disable OpenID support first and see what happens.

You wanted me to disable OpenID and continue(with enable PAS plugin) with google authentication. Am I on correct phase ?

1 Like

I did disabled OpenID and enabled PAS plugin, continue to login with google authentication same error repeated(as mentioned in the thread description). I really wanted to implement Google's authentication for plone site.

Yes, Google authentication requires pas.plugins.authomatic

Are you still getting an error stack that includes the openid files (like the bit below)?

Yes i have uninstalled PAS plugin, reinstalled it. Disabled OpenID, enabled only PAS plugin for google authentication.

Below is the configuration used for google Authentication(PAS Authomatic Plugin Settings):

{
  "google": 
  {
    "id": 1,
    "display": 
    {
      "title": "Google",
      "cssclasses": 
      {
        "button": "plone-btn plone-btn-default",
        "icon": "glypicon glyphicon-google"
      },
      "as_form": false
    },
    "propertymap": 
    {
      "email": "email",
      "link": "home_page",
      "location": "location",
      "name": "fullname"
    },
    "class_": "authomatic.providers.oauth2.Google",
    "consumer_key": "<consumer_key>",
    "consumer_secret": "<secret_key>",
    "scope": ["profile", "email"],
    "access_headers": {
      "User-Agent": "Plone (pas.plugins.authomatic)"
    }
  }
}

In above code, intentionally removed my consumer_key and secret_key. Where i will use actual values in my site in real time. :slight_smile: :stuck_out_tongue:

But one step progressed this time is that when i was clicking google login it was navigating to google authentication for asking credentials, on correct credentials submission found below error on redirection to plone site.

Still facing the same error, please find below pasted error trace.

Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module Shared.DC.Scripts.Bindings, line 322, in call
Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
Module Products.CMFCore.FSPageTemplate, line 237, in _exec
Module Products.CMFCore.FSPageTemplate, line 177, in pt_render
Module Products.PageTemplates.PageTemplate, line 87, in pt_render
Module zope.pagetemplate.pagetemplate, line 132, in pt_render
Module five.pt.engine, line 98, in call
Module z3c.pt.pagetemplate, line 163, in render
Module chameleon.zpt.template, line 261, in render
Module chameleon.template, line 191, in render
Module chameleon.template, line 171, in render
Module 9d6d55b4537202fb50d40b0d6f9b588c.py, line 451, in render
Module ba795c02562e44eb33513f0eaf48a47e.py, line 1223, in render_master
Module ba795c02562e44eb33513f0eaf48a47e.py, line 458, in render_content
Module 9d6d55b4537202fb50d40b0d6f9b588c.py, line 430, in __fill_main
Module 5a1ce0b10fe9e913dc61274c6904e1fe.py, line 106, in render_login_failed
Module 296a3daca7167e5b9b6633f535d14d94.py, line 242, in render_login
Module five.pt.expressions, line 135, in call
Module five.pt.expressions, line 126, in traverse
Module zope.traversing.adapters, line 136, in traversePathElement

  • traceback_info: ({'args': ()}, 'state')
    Module zope.traversing.adapters, line 50, in traverse

  • traceback_info: ({'args': ()}, 'state', ('getErrors',))
    LocationError: ({'args': ()}, 'state')

  • Expression: "options/state/getErrors"

  • Filename: ... 7.egg/Products/CMFPlone/skins/plone_login/login_form.cpt

  • Location: (line 28: col 23)

  • Source: errors options/state/getErrors;
    ^

  • Arguments: repeat: {...} (0)
    template: <ImplicitAcquisitionWrapper login_success at 0x7f87dc2cfaf0>
    modules: <instance - at 0x7f87e2511908>
    here: <ImplicitAcquisitionWrapper meritsPlone at 0x7f87d7f5edc0>
    user: <ImplicitAcquisitionWrapper - at 0x7f87d7f5ef00>
    nothing: <NoneType - at 0x7f87eca6ef70>
    container: <ImplicitAcquisitionWrapper meritsPlone at 0x7f87d7f5edc0>
    default: <object - at 0x7f87ecc69c30>
    request: <instance - at 0x7f87d555ea28>
    wrapped_repeat: <SafeMapping - at 0x7f87d553c050>
    traverse_subpath: <list - at 0x7f87d53c4b90>
    loop: {...} (0)
    context: <ImplicitAcquisitionWrapper meritsPlone at 0x7f87d7f5edc0>
    translate: <function translate at 0x7f87d4f40398>
    root: <ImplicitAcquisitionWrapper Zope at 0x7f87d7f3df00>
    options: {...} (1)
    target_language: <NoneType - at 0x7f87eca6ef70>

I interpret the error information above as follows:

  1. The login fails
  2. .../plone_login/login_form.cpt is called without the state keyword argument. Usually, the "form controller" would ensure that this argument is present (when the form has been submitted). Apparently, something has prevented this to happen.

I assume that the integration of the Google authentication is faulty: you should not get the Plone login form at all but instead get authenticated by Google (and therefore potentially see a Google login form).

Carefully, read the instructions on what PAS interfaces you must activate and deactivate to get the foreign authentication right (you likly must replace the challenge interface implementation).

thanks for understanding the issue. Can you please help me out to resolve this ? I needed badly to complete this

I (already) tried in my last message: likely, your PAS configuration is insufficient for the Google integration. Check the activation for the "challenge plugin": you do not want the standard Plone challenge (which presents the Plone login form) but a challenge which interacts with Google (to potentially perform a Google login). Likely, one of the PAS plugins you are using to get the Google integration can provide a corresponding challenge implementation (which would need to be activated in place of the standard Plone challenge).

I can not help you further. I do not have a Google account and can not set up Google authentication myself for testing purposes.

Any updates or any pointers to resolve the issue ?

It might help to start over on a new site in case the problem is caused by something that you did earlier

thanks it worked. :slight_smile:

we are good to close this thread now

To help others who read this thread, what was the fix/resolution?

Created a new credentials for google API and configured the same. it worked.

Great!

I've struggled to get Google auth to work myself. It would be great to have a series of step by step instructions and screenshots and get them into the package documentation.

i will try

Sure , I will do my level best to provide the sequence of steps with clear understanding. But not sure now , will do it some time later when I get free time.