InfluxDB 2 CLI Token

I need to create a token from the CLI using a BASH script. When I use influx setup I get “Error: instance at xxxx has already been setup”. I need to automate the creation of a new token with permission to read a bucket or automate the acquisition on the existing token without using the UI.

@Neydis_3D, influx setup is used for first time setup of admin user and initial org and bucket. Use influx auth for managing tokens and assigning r/w permission for buckets

influx auth denies access unless you have the token.

@Neydis_3D, you can retrieve token in the UI->Data->Tokens, or, if you have a local server that has been set up from the command line using influx setup, you can find token on the machine in ~/.influxdbv2/configs.

Once you have the token, use it in the -t option when running influx CLI tool.

Hello @Neydis_3D,
I know you said bash, but perhaps this will be useful anyways: