Installing insights on Ubuntu 16.4

Thanks @0x29a! I want to just say a big thank you for taking the time to answer my questions, its my first time working with something so complex…

I opted to go with a localhost installation for now since I want to get insights working at least and it seems like the shortest path.

I’m near the last steps of the guide and configuring the OAuth2:

In <lms Domain>/admin/oauth2_provider/application I added a new application with the following:

Client id: <generated Client id>
User: <created an insights superuser>
Redirect urls: <insightsDomain>:18110/complete/edx-oauth2/
Client type: Confidential
Authorization grant type: Authorization code
Client secret: <generated Client secret>
Name: <insights-sso>
Skip authorization: enabled

According to the instructions the Redirect urls should be <insightsDomain>:18110/complete/edx-oidc/, however it seems it has been discontinued so I changed it to <insightsDomain>:18110/complete/edx-oauth2/ instead. Also the suggested client method in step 7 seems to not exist anymore for koa.

I also have the following values for the insights.yml file:

SOCIAL_AUTH_EDX_OAUTH2_ISSUER: <lmsDomain>
SOCIAL_AUTH_EDX_OAUTH2_KEY: <generated Client id>
SOCIAL_AUTH_EDX_OAUTH2_LOGOUT_URL: <lmsDomain>/logout
SOCIAL_AUTH_EDX_OAUTH2_SECRET: <generated Client secret>
SOCIAL_AUTH_EDX_OAUTH2_URL_ROOT: <lmsDomain>
SOCIAL_AUTH_REDIRECT_IS_HTTPS: false

In <lms Domain>/admin/oauth_dispath/applicationaccess/
I also created a record insights with the following:

Application: insights
Scopes: user_id
Filters: <empty>

Am I missing anything or doing something wrong? When I try to log in at :18110 and login with credentials I get a 500 error:

Log from insights:

Apr 14 04:17:28 ip-172-31-69-160 [service_variant=insights][django.request][env:no_env] ERROR [ip-172-31-69-160  18004] [log.py:222] - Internal Server Error: /complete/edx-oauth2/
Traceback (most recent call last):
  File "/edx/app/insights/venvs/insights/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/edx/app/insights/venvs/insights/lib/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/edx/app/insights/venvs/insights/lib/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/edx/app/insights/venvs/insights/lib/python3.8/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/edx/app/insights/venvs/insights/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/edx/app/insights/venvs/insights/src/social-auth-app-django/social_django/utils.py", line 49, in wrapper
    return func(request, backend, *args, **kwargs)
  File "/edx/app/insights/venvs/insights/src/social-auth-app-django/social_django/views.py", line 31, in complete
    return do_complete(request.backend, _do_login, user=request.user,
  File "/edx/app/insights/venvs/insights/lib/python3.8/site-packages/social_core/actions.py", line 43, in do_complete
    user = backend.complete(user=user, *args, **kwargs)
  File "/edx/app/insights/venvs/insights/lib/python3.8/site-packages/social_core/backends/base.py", line 40, in complete
    return self.auth_complete(*args, **kwargs)
  File "/edx/app/insights/venvs/insights/lib/python3.8/site-packages/auth_backends/backends.py", line 98, in auth_complete
    user = super().auth_complete(*args, **kwargs)
  File "/edx/app/insights/venvs/insights/lib/python3.8/site-packages/social_core/utils.py", line 251, in wrapper
    return func(*args, **kwargs)
  File "/edx/app/insights/venvs/insights/lib/python3.8/site-packages/social_core/backends/oauth.py", line 387, in auth_complete
    self.process_error(self.data)
  File "/edx/app/insights/venvs/insights/lib/python3.8/site-packages/social_core/backends/oauth.py", line 379, in process_error
    raise AuthFailed(self, data.get('error_description') or
social_core.exceptions.AuthFailed: Authentication failed: unauthorized_client

I saw a post mentioning to get around this issue, we could downgrade an earlier version of insights. However, I am currently deployed on koa and don’t think that is an option.