Configure OAuth in Open edx
Configuring Open edX is very similar for Google, Facebook, LinkedIn, and Azure.
In the
lms.env.jsonfile, change the value ofFEATURES>ENABLE_THIRD_PARTY_AUTHtotrue(it isfalseby default).If necessary, make sure that the correct backend is specified.
If you are using Google, Facebook, LinkedIn, or Active Directory, open the
lms.env.jsonfile and look for theTHIRD_PARTY_AUTH_BACKENDSlist. By default, the file does not contain this list.If the
lms.env.jsonfile does not contain theTHIRD_PARTY_AUTH_BACKENDSlist, you do not have to complete any additional steps.If the
lms.env.jsonfile contains theTHIRD_PARTY_AUTH_BACKENDSlist, add the backend for the applicable IdP to the list.- For Google, add
"social_core.backends.google.GoogleOAuth2". - For Facebook, add
"social_core.backends.facebook.FacebookOAuth2". - For LinkedIn, add
"social_core.backends.linkedin.LinkedinOAuth2". - For Azure Active Directory, add
"social_core.backends.azuread.AzureADOAuth2".
- For Google, add
If you are using a custom backend, add the applicable OAuth2 provider to the
THIRD_PARTY_AUTH_BACKENDSlist in thelms.env.jsonfile. If the file does not contain theTHIRD_PARTY_AUTH_BACKENDSlist, create the list, and then add the OAuth2 provider.
For more information, see the AWS template file file in GitHub.
In the
lms.auth.jsonfile, add the client secret. To do this, create theSOCIAL_AUTH_OAUTH_SECRETSkey if the key does not already exist, and then add the appropriate value for your IdP.Note
If you are using Ansible, set the
EDXAPP_SOCIAL_AUTH_OAUTH_SECRETSvariable.For Google, add the following value.
"SOCIAL_AUTH_OAUTH_SECRETS": { "google-oauth2": "abcdef123456789101112131" }For Facebook, add the following value.
"SOCIAL_AUTH_OAUTH_SECRETS": { "facebook": "98765432181bbe3a2596efa8ba7abcde" }For LinkedIn, add the following value.
"SOCIAL_AUTH_OAUTH_SECRETS": { "linkedin-oauth2": "4D3Cb2aB1C0dEFGH" }For Azure, add the following value.
"SOCIAL_AUTH_OAUTH_SECRETS": { "azuread-oauth2": "abcdef12341yHlmOrR8D3vlV1cD2VtL7k9xk9DSB8vw=" }
Restart the LMS server so that it will use the new settings.
Comments
Post a Comment