Using API token with Swagger

Hi Folks,

I’m trying to generate an API key that I can use with swagger for the REST API. I’ve tried creating one in the UI (as admin) and from the command line with

/opt/chirpstack/chirpstack --config /etc/chirpstack/chirpstack  create-api-key --name cli
2024-02-07T13:17:05.377560Z  INFO chirpstack::storage: Setting up PostgreSQL connection pool
2024-02-07T13:17:05.431838Z  INFO chirpstack::storage: Applying schema migrations
2024-02-07T13:17:05.434539Z  INFO chirpstack::storage: Setting up Redis client
2024-02-07T13:17:05.480258Z  INFO chirpstack::storage::api_key: Api-key created id=3d30dcab-7df8-415a-8d19-d125738f7b76
id: 3d30dcab-7df8-415a-8d19-d125738f7b76
token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJjaGlycHN0YWNrIiwiaXNzIjoiY2hpcnBzdGFjayIsInN1YiI6IjNkMzBkY2FiLTdkZjgtNDE1YS04ZDE5LWQxMjU3MzhmN2I3NiIsInR5cCI6ImtleSJ9.JHdw5SPCJJjvf4bcR6c93MamtRazuLGtJjgv9UtuRGU

However in both cases after then using the token in the Authorise section of the swagger and trying to do something like “GET /api/applications” gives:

401: authorization metadata must in format 'Bearer

OK, found it - and in case it help others you have to post the token into the swagger UI as

Bearer <<token>>

I think in v3 you just had to paste the token value in

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.