Get service token I generated from doppler CLI

I’m trying to get service token I generated from cli.
I use this to generate a token inside a script.

doppler configs tokens create token --project ${doppler_project} --config ${doppler_config} --plain --access 'read/write'  --max-age '15m'

I do not want to generate token again and again when I run script if a token is available and is still valid. How can I do that?
Doing following throws me error saying Doppler Error: invalid service token slug

doppler configs tokens get token --project ${doppler_project} --config ${doppler_config}

Hi @Ashok_Renukappa!

Welcome to the Doppler Community!

That command will create the token and supply its value to you. After its initially created, you won’t be able to access the token value again, so it’s up to you to store it somehow. If you’re a developer working locally, you usually would use your CLI token that populates in your local environment when you run doppler login and is used by default for any CLI commands.

In a production environment, you will typically create the Doppler token and then store it as an environment variable in whatever service you’re using. If you set it as the DOPPLER_TOKEN environment variable, then the CLI will automatically use it. If you need more than one token in the same environment, then you can set variables like DOPPLER_TOKEN_WEB and DOPPLER_TOKEN_API and then use the --token CLI flag to pass that value through the CLI (or you could execute the command via something like DOPPLER_TOKEN=${DOPPLER_TOKEN_WEB} doppler run -- ....

Does that help at all? If not, could you elaborate a bit about your use case and what you’re trying to do?

Regards,
-Joel