From a3bb22422a12d1f68f324b8fe2ed53ca8eff765e Mon Sep 17 00:00:00 2001 From: "Aleksei G." Date: Wed, 7 Aug 2024 11:19:38 +0300 Subject: [PATCH] BASE_URL is now taken from lms.yml --- oauth2_wordpress/wp_oauth.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/oauth2_wordpress/wp_oauth.py b/oauth2_wordpress/wp_oauth.py index 4b84390..8779624 100644 --- a/oauth2_wordpress/wp_oauth.py +++ b/oauth2_wordpress/wp_oauth.py @@ -4,10 +4,6 @@ written by: Lawrence McDaniel date: oct-2022 -usage: subclass of BaseOAuth2 Third Party Authtencation client to - handle the field mapping and data conversions between - the dict that WP Oauth returns versus the dict that Open edX - actually needs. """ import json from urllib.parse import urlencode @@ -16,12 +12,12 @@ from urllib.parse import urljoin from logging import getLogger from social_core.backends.oauth import BaseOAuth2 from django.contrib.auth import get_user_model - +from django.conf import settings User = get_user_model() logger = getLogger(__name__) -VERBOSE_LOGGING = True +VERBOSE_LOGGING = False class WPOpenEdxOAuth2(BaseOAuth2): @@ -50,12 +46,13 @@ class WPOpenEdxOAuth2(BaseOAuth2): # Third Party Authentication / Provider Configuration (OAuth) # setup page drop-down box titled, "Backend name:", just above # the "Client ID:" and "Client Secret:" fields. + name = "wp-oauth" # note: no slash at the end of the base url. Python Social Auth # might clean this up for you, but i'm not 100% certain of that. - BASE_URL = "https://set-me-please.com" - + BASE_URL = settings.FEATURES.get('WP_PROVIDER_URL') + # a path to append to the BASE_URL: https://oauth_host.com/oauth/ PATH = "oauth/"