Is it possilbe to set the access control JWT token from the CLI


I can’t find a reference in the docs, but on the off chance it is possible and not documented.

Is it possible to set the JWT secret for the access control for a site using the CLI?



Hello @PDS , thanks for posting.
You can learn how to manage your environment variables with Netlify CLI by visiting the reference API documentation link below.

Alternatively Netlify has a blog post on how to manage your environment variables using the Netlify CLI. Below is the blog post link.

Hope this helps.

Hey @PDS

As per the post below, there is currently no way of reading the JWT

You might also find the following post (from the same thread) relevant

1 Like


Hi - thanks for your reply.

Those docs are what lead me to ask the question. I am able to manage all my env variables, but the access control JWT secret sits outside of this in the UI and is not listed in the those docs. So I just wondered if it was possible but not documented.



I believe it should be possible using our API, but not documented, and possibly not doable via CLI - not entirely sure if you can run non-documented API calls via the CLI? However, you can do it :slight_smile: . Following the workflow here:

…I reverse engineered what our UI does and this seems to be the API call in question (for the site):

with payload:

{jwt_secret:"the secret"}

Try that out (preferably on a non-production site), and let me know how it goes!


Just circling back to say that your solution worked.

FYI I had to add it to the body in the api call:

"body": {
  "jwt_secret":"the secret"

I came across that issue before when adding a custom subdomain and support were in touch with the CLI team and that was the solution.

Thanks for you help, I now have a single deploy script that does everything I need :+1:



Thanks for coming back and letting us know! Happy building!


No worries. I think it is important to close things off so people have a reference point. I get plenty of mileage out of other posts in the community :grinning:



That is great to hear-- I am glad you find this community helpful! I may be biased, but I also think it is pretty great :grin: