BASE_URL is now taken from lms.yml

This commit is contained in:
Aleksei G. 2024-08-07 11:19:38 +03:00
parent 0d52c5902c
commit a3bb22422a

View File

@ -4,10 +4,6 @@ written by: Lawrence McDaniel
date: oct-2022 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 import json
from urllib.parse import urlencode from urllib.parse import urlencode
@ -16,12 +12,12 @@ from urllib.parse import urljoin
from logging import getLogger from logging import getLogger
from social_core.backends.oauth import BaseOAuth2 from social_core.backends.oauth import BaseOAuth2
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.conf import settings
User = get_user_model() User = get_user_model()
logger = getLogger(__name__) logger = getLogger(__name__)
VERBOSE_LOGGING = True VERBOSE_LOGGING = False
class WPOpenEdxOAuth2(BaseOAuth2): class WPOpenEdxOAuth2(BaseOAuth2):
@ -50,11 +46,12 @@ class WPOpenEdxOAuth2(BaseOAuth2):
# Third Party Authentication / Provider Configuration (OAuth) # Third Party Authentication / Provider Configuration (OAuth)
# setup page drop-down box titled, "Backend name:", just above # setup page drop-down box titled, "Backend name:", just above
# the "Client ID:" and "Client Secret:" fields. # the "Client ID:" and "Client Secret:" fields.
name = "wp-oauth" name = "wp-oauth"
# note: no slash at the end of the base url. Python Social Auth # 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. # 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/ # a path to append to the BASE_URL: https://oauth_host.com/oauth/
PATH = "oauth/" PATH = "oauth/"