# Get service token I generated from doppler CLI

**URL:** https://community.doppler.com/t/get-service-token-i-generated-from-doppler-cli/676
**Category:** Need Help
**Created:** [June 30, 2022, 8:15pm UTC](https://community.doppler.com/t/get-service-token-i-generated-from-doppler-cli/676 "2022-06-30T20:15:05Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Ashok\_Renukappa](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/ashok_renukappa/32/472_2.png) [@Ashok\_Renukappa](https://community.doppler.com/u/Ashok_Renukappa)
#### Post date: [June 30, 2022, 8:15pm UTC](https://community.doppler.com/t/get-service-token-i-generated-from-doppler-cli/676/1 "2022-06-30T20:15:05Z")

</div>

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

```auto
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`

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

```

---

<div class="post-metadata">

### Author: ![watsonian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/watsonian/32/267_2.png) [@watsonian](https://community.doppler.com/u/watsonian)
#### Post date: [July 1, 2022, 3:10pm UTC](https://community.doppler.com/t/get-service-token-i-generated-from-doppler-cli/676/2 "2022-07-01T15:10:35Z")

</div>

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
