netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
16.14k stars 2.58k forks source link

GraphQL authentication is not available when LOGIN_REQUIRED is true #16583

Closed antoinekh closed 4 months ago

antoinekh commented 4 months ago

Deployment Type

Self-hosted

NetBox Version

4.0.5

Python Version

3.10

Steps to Reproduce

  1. Set LOGIN_REQUIRED to true in the Netbox configuration
  2. Try to make a graphql request with TOKEN auth

This is similar to this BUG from the past for API auth https://github.com/netbox-community/netbox/issues/724

Expected Behavior

Able to go to /graphql to be able to make request with auth with TOKEN

Observed Behavior

Redirect to login page

<!DOCTYPE html>
<html
  lang="en"
  data-netbox-url-name="login"
  data-netbox-base-path=""
  >
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width, viewport-fit=cover" />
    <meta name="htmx-config" content='{"scrollBehavior": "auto"}'>

    <title>Home | NetBox</title>
antoinekh commented 4 months ago

It was a mistake in my environment. It’s already implemented with middleware and settings.AUTH_EXEMPT_PATHS

sorry for the lost of time