netbox-community / Device-Type-Library-Import

This library is intended to assist with importing device and module types into NetBox from the NetBox Community DeviceType-Library
https://github.com/netbox-community/devicetype-library
MIT License
256 stars 77 forks source link

{"detail":"Invalid token"} #6

Closed Trev-W closed 3 years ago

Trev-W commented 3 years ago

Running the script results in the above error - it reads the vendor and device and then spits this out, even though the NETBOX_TOKEN was copied from opt/netbox/netbox/netbox/configuration.py

`python3 nb-dt-import.py --vendor HPE Pulled Repo Package devicetype-library is already installed, updating Vendor Specified, Gathering All Matching Device-Types 1 Vendors Found 3 Device-Types Found {"detail":"Invalid token"} {"detail":"Invalid token"} {"detail":"Invalid token"} {"detail":"Invalid token"}

0 devices created 0 interfaces/ports updated 0 manufacturers created`

ndom91 commented 3 years ago

Have you given this token write rights in Netbox?

Trev-W commented 3 years ago

Sorry Nico, is that the REMOTE_AUTH_ENABLED setting?

On Sun, 8 Nov. 2020, 5:45 pm Nico Domino, notifications@github.com wrote:

Have you given this token write rights in Netbox?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/minitriga/Netbox-Device-Type-Library-Import/issues/6#issuecomment-723553177, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK3O4H4BXQWZ2ZHYWSS5KWLSOZSCLANCNFSM4TOEHVKA .

ndom91 commented 3 years ago

Sorry what do you mean you copied the token from the configuration.py file?

You have to generate an API token in the user settings, like so:

image

image

Then select "Add a token" at the bottom of the page

And make sure "Write Enabled" is checked.

image

The generated token is what you have to use with this script.

Trev-W commented 3 years ago
Thank you very much Nico I was exporting the SECRET_KEY 🤦‍♂️ Sent from Mail for Windows 10 From: Nico DominoSent: Sunday, 8 November 2020 11:48 PMTo: minitriga/Netbox-Device-Type-Library-ImportCc: Trev-W; AuthorSubject: Re: [minitriga/Netbox-Device-Type-Library-Import] {"detail":"Invalid token"} (#6) Sorry what do you mean you copied the token from the configuration.py file?You have to generate an API token in the user settings, like so:Then select "Add a token" at the bottom of the pageAnd make sure "Write Enabled" is checked.The generated token is what you have to use with this script.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.  This email has been checked for viruses by Avast antivirus software. www.avast.com