Contentful logo

Contentful Community

How to manage mutliple content management tokens within the contentful cli

Hello,

I have to switch between several content management tokens to use the contentful cli and I was wondering if there is a nice way to handle those?

I do not want to always copy and paste the token.

Is there a way?

Hi @simon.plutz

The management token information used bu the CLI are stored in a file called .contentfulrc.json in the home folder of your user (to see it you can run cat ~/.contentfulrc.json). You could create a simple bash script that switches that file based on the environment you need to access.

See also:
https://www.contentful.com/developers/docs/tutorials/cli/authentication/