question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

External Auth OIDC NoReverseMatch exception

See original GitHub issue

Environment

  • Nautobot version (Docker tag too if applicable): 1.3.5-py3.8
  • Python version: 3.8.13
  • Nautobot version: 1.3.5
  • Database platform, version: postgre
  • Middleware(s):

Steps to Reproduce

  1. Activate the external authentication with this settings :
AUTHENTICATION_BACKENDS = [
    "social_core.backends.open_id_connect.OpenIdConnectAuth",
    "nautobot.core.authentication.ObjectPermissionBackend",
]
SOCIAL_AUTH_OIDC_OIDC_ENDPOINT = 'https://xxxx'
SOCIAL_AUTH_OIDC_KEY = 'nautobot'
SOCIAL_AUTH_OIDC_SECRET = 'xxxxx'
  1. Go to home page

Expected Behavior

Should display the normal home page

Observed Behavior

image

15:12:39.637 ERROR   django.request       log.py                            log_response() :
  Internal Server Error: /
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 204, in _get_response
    response = response.render()
  File "/usr/local/lib/python3.8/site-packages/django/template/response.py", line 105, in render
    self.content = self.rendered_content
  File "/usr/local/lib/python3.8/site-packages/django/template/response.py", line 83, in rendered_content
    return template.render(context, self._request)
  File "/usr/local/lib/python3.8/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 170, in render
    return self._render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/loader_tags.py", line 195, in render
    return template.render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 172, in render
    return self._render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/defaulttags.py", line 315, in render
    return nodelist.render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/defaulttags.py", line 315, in render
    return nodelist.render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/usr/local/lib/python3.8/site-packages/django/template/defaulttags.py", line 449, in render
    url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
  File "/usr/local/lib/python3.8/site-packages/django/urls/base.py", line 86, in reverse
    return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/django/urls/resolvers.py", line 698, in _reverse_with_prefix
    raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'begin' with arguments '('',)' not found. 1 pattern(s) tried: ['login/(?P<backend>[^/]+)/\\Z']

Do you have a clue of how to fix it ? I didn’t click on Login button to get this error …

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
FloLacocommented, Sep 15, 2022

I tried to install social-auth-core==4.3.0 within the Dockerfile, but I don’t know exactly why, but it upgrades my nautobot to 1.4.x too … So I rollback to my previous Dockerfile and exec the pip install social-auth-core==4.3.0 command when my container was up, and it’s a success, it fix the issue.

I’ll try to upgrade to nautobot 1.4 so.

Just for reference, if we use a OIDC server with self certificate SSL or with custom CA, you need to import your CA in the nautobot container like this : in Dockerfile :

COPY yourCA.pem /usr/local/share/ca-certificates/yourCA.crt
USER root
RUN update-ca-certificates
ENV REQUESTS_CA_BUNDLE "/etc/ssl/certs/ca-certificates.crt"
USER nautobot
0reactions
bryanculvercommented, Sep 19, 2022

Closing issue as this is fixed in a newer release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Saleor for external authentication and data synch #10522
Hello : My use case : I currently have a Django Blogging app as a backend with postid(product post id in case it...
Read more >
Guide to External Authentication - OpenID Connect
External authentication allows your server's users to log in to WHM, cPanel, and Webmail through OpenID Connect-compliant identity providers ...
Read more >
Is it possible to wire up external authentication after ...
During startup, I retrieve all federation configurations (both Oidc and WsFed) and wire them up in ConfigureServices. But imagine a multi- ...
Read more >
External OAUTH Authentication - NGINX Ingress Controller
This example will show you how to deploy oauth2_proxy into a Kubernetes cluster and use it to protect the Kubernetes Dashboard using GitHub...
Read more >
External ID Token Authentication ( OIDC )for Rest APIs
OIDC stands for OpenID Connect (http://openid.net/connect/). It is an authentication layer on top of OAuth 2.0 It allows clients, like ServiceNow, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found