Hello Team!
In the process configuring API communication to LMS from discovery service, I have created client id and secret from LMS admin and configured in the discovery.yml in
SOCIAL_AUTH_EDX_OAUTH2_KEY and SOCIAL_AUTH_EDX_OAUTH2_SECRET respectively and restarted the discovery service. I have also created a partner in the discovery admin panel https://test.discovery.example.com/admin/core/partner. I have given LMS URL, LMS Admin URL, Studio URL and Courses API URL parameters.
I have observed that the JWT tokens are already generated and I didn’t disturb them.
Now, when I tried to refresh the course metadata, I got the following error:
discovery@ip-:~/discovery$ ./manage.py refresh_course_metadata 2021-04-13 10:00:01,930 INFO 30229 [algoliasearch_django.registration] /edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/algoliasearch_django/registration.py:74 - REGISTER <class ‘course_discovery.apps.course_metadata.algolia_models.AlgoliaProxyProduct’> 2021-04-13 10:00:04,247 INFO 30229 [course_discovery.apps.course_metadata.management.commands.refresh_course_metadata] /edx/app/discovery/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py:116 - Command is not using threads to write data. 2021-04-13 10:00:04,254 INFO 30229 [course_discovery.apps.course_metadata.management.commands.refresh_course_metadata] /edx/app/discovery/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py:153 - Executing Loader [https://test.lms.example.com/api/courses/v1/] 2021-04-13 10:00:04,402 ERROR 30229 [course_discovery.apps.course_metadata.management.commands.refresh_course_metadata] /edx/app/discovery/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py:28 - CoursesApiDataLoader failed! Traceback (most recent call last): File “/edx/app/discovery/discovery/course_discovery/apps/course_metadata/management/commands/refresh_course_metadata.py”, line 25, in execute_loader loader_class(*loader_args).ingest() File “/edx/app/discovery/discovery/course_discovery/apps/course_metadata/data_loaders/init.py”, line 31, in init self.username = self.get_username_from_client(self.api_client) File “/edx/app/discovery/discovery/course_discovery/apps/course_metadata/data_loaders/init.py”, line 41, in get_username_from_client token = client.get_jwt_access_token() File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/edx_rest_api_client/client.py”, line 270, in get_jwt_access_token self._ensure_authentication() File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/edx_rest_api_client/client.py”, line 254, in _ensure_authentication timeout=self._timeout, File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/edx_rest_api_client/client.py”, line 170, in get_and_cache_oauth_access_token timeout=timeout, File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/edx_rest_api_client/client.py”, line 115, in get_oauth_access_token response.raise_for_status() # Raise an exception for bad status codes. File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/requests/models.py”, line 941, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://test.lms.example.com/oauth2/access_token CommandError: One or more of the data loaders above failed.
Please let me know if the configuration was wrong and how should I rectify it.
Please help.
Thanks,
Mohan.