# how to fetch JWT\_SECRET=a\_long\_random\_secret\_here

**URL:** <https://community.auth0.com/t/how-to-fetch-jwt-secret-a-long-random-secret-here/195344>\
**Category:** JWT.io\
**Created:** [December 9, 2025, 12:34pm UTC](https://community.auth0.com/t/how-to-fetch-jwt-secret-a-long-random-secret-here/195344 "2025-12-09T12:34:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![himakshimanmode24](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/himakshimanmode24/32/77725_2.png) [@himakshimanmode24](https://community.auth0.com/u/himakshimanmode24)\
**Post date:** [December 9, 2025, 12:34pm UTC](https://community.auth0.com/t/how-to-fetch-jwt-secret-a-long-random-secret-here/195344/1 "2025-12-09T12:34:16Z")

</div>

how to fetch JWT\_SECRET=a\_long\_random\_secret\_here

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [December 31, 2025, 2:23pm UTC](https://community.auth0.com/t/how-to-fetch-jwt-secret-a-long-random-secret-here/195344/2 "2025-12-31T14:23:16Z")

</div>

Hi @himakshimanmode24

Welcome to the Auth0 Community!

Could you please provide more details regarding your question?

Thanks!  
Dawid

---

<div class="post-metadata">

**Author:** ![gerald.czifra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gerald.czifra/32/75301_2.png) [@gerald.czifra](https://community.auth0.com/u/gerald.czifra)\
**Post date:** [October 15, 2026, 9:25pm UTC](https://community.auth0.com/t/how-to-fetch-jwt-secret-a-long-random-secret-here/195344/3 "2026-10-15T21:25:39Z")

</div>

Hi everyone,

We are looking to optimize and provide additional information to Community Topics that others might find useful, or where a common issue is presented.

I understand you are looking to acquire or fetch a `JWT_SECRET`in the context of Auth0 to configure your backend or application environment (such as `JWT_SECRET=a_long_random_secret_here`). The correct approach depends on whether you are verifying tokens signed by Auth0, or signing your own internal tokens.

### Recommended solutions

Below is a breakdown of how to obtain the appropriate secret or key based on your architecture :

**Scenario A: You want to verify JWTs issued by Auth0 (Recommended: RS256)**

If Auth0 is acting as your Identity Provider (IdP) and issuing tokens, **you should not use a symmetric shared secret (`JWT_SECRET`)**. Modern applications use **asymmetric signing (RS256)**.

In this flow:

- **Auth0** signs the token using its **Private Key** (which it never shares) .

- **Your Backend** verifies the token using Auth0’s **Public Key**.

To fetch the public keys dynamically, your backend should query your tenant’s public **JWKS (JSON Web Key Set)** endpoint :

```auto
https://{your_auth0_domain}/.well-known/jwks.json

```

Libraries like [`jwks-rsa`](https://github.com/auth0/node-jwks-rsa) or [`express-jwt`](https://github.com/auth0/express-jwt) can be configured to fetch and cache these keys automatically, eliminating the need to hardcode any `JWT_SECRET` .

**Scenario B: You are using Symmetric Signing (HS256) in Auth0**

If you have explicitly configured your Auth0 API or Application to use **HS256** (symmetric cryptography), the token is signed and verified using the same secret key . In Auth0, **this shared secret is your Application’s Client Secret**.

To fetch it:

1. Log in to your **Auth0 Dashboard** ;

2. Navigate to **Applications** \> **Applications** and select your application;

3. Under the **Settings** tab, locate the **Client Secret** field;

4. Copy this value and set it as your environment variable:

**Note:** If you are verifying tokens for an API, go to **Applications** \> **APIs** , select your custom API, and retrieve the Signing Secret under its settings tab.

**Scenario C: You are signing your own internal session/app tokens (e.g., NextAuth, Buggregator, Retool)**

If your framework or tool (like Retool or NextAuth) uses Auth0 for login but handles its own session management, it often requires a local `JWT_SECRET` to sign its own internal session JWTs. This secret **is not generated by Auth0**. You must generate a secure, cryptographically strong random string yourself and provide it to your environment variables:

**Run one of the following commands in your terminal to generate a secure secret:**

- **Using OpenSSL (Standard):**

- **Using Node.js:**

**Copy the generated output and assign it to your environment variable:**

```auto
JWT_SECRET=6a4f91b7d5e... (your generated hex string)

```

**Common Pitfalls & Security Best Practices**

- **Don’t share or commit your secret:** Never commit your `JWT_SECRET` or `Client Secret` to version control (like GitHub) . Always load them securely using environment variables (`.env` files or system environment setups) .

- **Prefer RS256:** It is highly recommended to migrate your Auth0 settings to use [**RS256** instead of **HS256**](https://auth0.com/blog/rs256-vs-hs256-whats-the-difference/) . Since RS256 relies on public keys for verification, your backend is at no risk of leaking a signing secret if its environment is compromised .

We hope this provided some useful information to help you achieve your desired outcome!

Have a great one,  
Gerald

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [October 17, 2026, 9:26pm UTC](https://community.auth0.com/t/how-to-fetch-jwt-secret-a-long-random-secret-here/195344/4 "2026-10-17T21:26:26Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
