使用azuread-oauth2在exchange_access_token上的openEdx服务器错误

问题描述 投票:1回答:1

我现在正在部署openEdx系统,并在从移动设备通过Azure AD登录时遇到错误。

Web Azure AD登录工作正常,我也可以从azure广告获取access_token。

但是,当我尝试通过/ oauth2 / exchange_access_token / azuread-oauth2 / url与openEdx令牌交换azure令牌时,由于空响应,我收到以下错误。

AttributeError:'NoneType'对象没有属性'get'

因此,我对openEdx还不熟悉,我很难找到解决问题的方法。请帮助我指导解决此问题的正确途径。以下是详细错误日志。

提前致谢

Apr  1 12:38:45 edxapp [service_variant=lms][django.request][env:sandbox] ERROR [edxapp  24509] [exception.py:135] - Internal Server Error: /oauth2/exchange_access_token/azuread-oauth2/
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 185, in inner
    return func(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/oauth_dispatch/views.py", line 57, in dispatch
    return view(request, *args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 67, in _wrapper
    return bound_func(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 63, in bound_func
    return func.__get__(self, type(self))(*args2, **kwargs2)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 67, in _wrapper
    return bound_func(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/social_django/utils.py", line 49, in wrapper
    return func(request, backend, *args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 63, in bound_func
    return func.__get__(self, type(self))(*args2, **kwargs2)
  File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/auth_exchange/views.py", line 44, in dispatch
    return super(AccessTokenExchangeBase, self).dispatch(*args, **kwargs)
   File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/views.py", line 489, in dispatch
    response = self.handle_exception(exc)
 File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/views.py", line 449, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/views.py", line 486, in dispatch
    response = handler(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/auth_exchange/views.py", line 57, in post
    if not form.is_valid():
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/forms/forms.py", line 183, in is_valid
    return self.is_bound and not self.errors
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/forms/forms.py", line 175, in errors
    self.full_clean()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/forms/forms.py", line 385, in full_clean
    self._clean_form()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/provider/forms.py", line 63, in _clean_form
    super(OAuthForm, self)._clean_form()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/forms/forms.py", line 412, in _clean_form
    cleaned_data = self.clean()
  File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/auth_exchange/forms.py", line 95, in clean
    user = backend.do_auth(access_token, allow_inactive_user=True)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/social_core/utils.py", line 252, in wrapper
    return func(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/social_core/backends/oauth.py", line 410, in do_auth
    data = self.user_data(access_token, *args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/social_core/backends/azuread.py", line 80, in user_data
    id_token = response.get('id_token')
AttributeError: 'NoneType' object has no attribute 'get'
django azure openedx
1个回答
0
投票

social-core抛出错误,因为响应是NoneType。当你瞄准第三方oAuth2时,social-core在这里负责是有道理的。如果它在web上运行,那么只有在配置错误时才能解释None响应。

现在,进行故障排除的步骤:

  1. 检查edx.properties以确保正确设置config目录。
  2. 检查你的configlocal yamls以确保oauth配置正确。 [而不是简单地配置ios.yaml]
  3. 请务必遵循here提供的其他说明。
  4. 如果没有其他工作,请检查social-auth的配置,如here所述。

希望有所帮助!干杯!

© www.soinside.com 2019 - 2024. All rights reserved.