You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using NetBox with an OIDC (OpenID Connect) proxy for authentication, the nb.version property consistently returns an empty string (''). This issue arises because the get_version method in pynetbox does not receive the API-Version header, as the request is redirected to the OIDC login page due to missing authorization.
Steps to Reproduce:
Set up NetBox behind an OIDC proxy with the following Apache configuration:
The nb.version property should return the correct NetBox version string.
Actual Behavior:
The nb.version property returns an empty string.
Cause:
The OIDC proxy redirects unauthorized requests to the login page, causing the get_version method to miss the API-Version header.
Proposed Solution:
Modify the version property in pynetbox/core/api.py to ensure the authorization token is passed to the get_version method. Here's the proposed change:
@propertydefversion(self):
"""Gets the API version of NetBox. Can be used to check the NetBox API version if there are version-dependent features or syntaxes in the API. :Returns: Version number as a string. :Example: >>> import pynetbox >>> nb = pynetbox.api( ... 'http://localhost:8000', ... token='your_token_here' ... ) >>> nb.version '3.1' >>> """version=Request(
base=self.base_url,
token=self.token, # Ensure the token is passed herehttp_session=self.http_session,
).get_version()
returnversion
Additional Context:
The issue is specific to environments where NetBox is protected by an OIDC proxy, requiring a valid token for API access.
Expected Behavior
nb.version
'4.0'
Observed Behavior
nb.version
''
The text was updated successfully, but these errors were encountered:
pynetbox version
v7.4.0
NetBox version
v4.0.9
Python version
3.11
Steps to Reproduce
Description:
When using NetBox with an OIDC (OpenID Connect) proxy for authentication, the
nb.version
property consistently returns an empty string (''
). This issue arises because theget_version
method inpynetbox
does not receive theAPI-Version
header, as the request is redirected to the OIDC login page due to missing authorization.Steps to Reproduce:
Set up NetBox behind an OIDC proxy with the following Apache configuration:
Use pynetbox to access the API.
Call the
nb.version
property.Observe that
nb.version
returns an empty string.Expected Behavior:
The
nb.version
property should return the correct NetBox version string.Actual Behavior:
The
nb.version
property returns an empty string.Cause:
The OIDC proxy redirects unauthorized requests to the login page, causing the
get_version
method to miss theAPI-Version
header.Proposed Solution:
Modify the
version
property inpynetbox/core/api.py
to ensure the authorization token is passed to theget_version
method. Here's the proposed change:Additional Context:
The issue is specific to environments where NetBox is protected by an OIDC proxy, requiring a valid token for API access.
Expected Behavior
Observed Behavior
The text was updated successfully, but these errors were encountered: