Users can create tokens for themselves, but UI does not reflect that. #4713

Closed
opened 2025-12-29 19:19:44 +01:00 by adam · 0 comments
Owner

Originally created by @NiclasSP on GitHub (Mar 31, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v2.10.4

Python version

3.6

Steps to Reproduce

  1. Active user(no permissions needed).

  2. Check /user/api-tokens/. Notice the missing options for creating/modifying/deleting API Tokens. (Except for Copy if you have any token already)

  3. Send post request(Login done earlier):
    URL:
    https://[URL]/user/api-tokens/add/
    Headers:
    {'Referer': 'https://[URL]/login/'}
    Data:
    {'csrfmiddlewaretoken': '[Token from login]', 'write_enabled': 'on', 'description': '[description]'}

  4. If you then check /user/api-tokens/, you now have a token.

Expected Behavior

I would expect to able to create/modify/delete API token for my own user, since these should only give the same access as my weblogin.

Observed Behavior

I can create a token(modify/delete not checked), using post request but the options are not available in the presented GUI.
If as a user(without token perms) go to this url(/user/api-tokens/add/) i receive an empty page.

Originally created by @NiclasSP on GitHub (Mar 31, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v2.10.4 ### Python version 3.6 ### Steps to Reproduce 1. Active user(no permissions needed). 2. Check /user/api-tokens/. Notice the missing options for creating/modifying/deleting API Tokens. (Except for Copy if you have any token already) 3. Send post request(Login done earlier): URL: https://[URL]/user/api-tokens/add/ Headers: {'Referer': 'https://[URL]/login/'} Data: {'csrfmiddlewaretoken': '[Token from login]', 'write_enabled': 'on', 'description': '[description]'} 4. If you then check /user/api-tokens/, you now have a token. ### Expected Behavior I would expect to able to create/modify/delete API token for my own user, since these should only give the same access as my weblogin. ### Observed Behavior I can create a token(modify/delete not checked), using post request but the options are not available in the presented GUI. If as a user(without token perms) go to this url(/user/api-tokens/add/) i receive an empty page.
adam added the type: bugstatus: accepted labels 2025-12-29 19:19:45 +01:00
adam closed this issue 2025-12-29 19:19:45 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4713