Tutor mfe - authn - how to add google oauth authorization?

Hi, I need to enable google oauth and here is what I tried:

  1. Created tutor plugin with
from tutor import hooks

hooks.Filters.ENV_PATCHES.add_items([
    (
        "common-env-features",
        '"ENABLE_THIRD_PARTY_AUTH": true',
    ),
    (
        "common-env-features",
        '"ENABLE_COMBINED_LOGIN_REGISTRATION": true',
    ),
    (
        "openedx-auth",
        "'SOCIAL_AUTH_OAUTH_SECRETS': {'google-oauth2': 'my_key'}"
    ),
    (
        "lms-env",
        "'THIRD_PARTY_AUTH_BACKENDS': ['social_core.backends.google.GoogleOAuth2']"
    ),
])

Enabled it, restarted tutor
2. Added configuration in django admin panel as stated here
https://edx.readthedocs.io/projects/edx-installing-configuring-and-running/en/latest/configuration/tpa/tpa_integrate_open/tpa_oauth.html#add-the-provider-configuration

But I still can’t get google auth button on login page, what is the best way to enable it?
Logs show no errors

Can you confirm you went through these steps in particular?

In any case, are you familiar with your browser’s developer tools? On the network tab and after reloading the authentication page, can you find requests to /api/mfe_context in your LMS instance? What does the server response to that request consist of?

You should be able to find Google listed in a JSON list named "providers". Whether it’s there or not will inform you whether the LMS is instructing the MFE to display the proper SSO button. (In other words, if it’s not there, the problem is in the backend.)

But more important than anything else, have you configured your keys at Google in order to support oauth2 in Open edX?

It doesn’t happen magically. You need to follow these instructions:
Setting up OAuth 2.0 - Google Cloud Platform Console Help.

1 Like

And make sure that your THIRD_PARTY_AUTH_BACKENDS is in the openedx-lms-common-settings patch in your plugins. That’s where we put it in.

1 Like