[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[Help](/c/help/9)

# OIDC Refresh

142 views · 0 likes · 4 posts


ashlooz (@ashwinprabou) · 2025-12-03

Does OIDC refresh periodically during production? For every refresh, does it store the latest token in the environment variable?

I have had previous issues where it would pass \~9 hours and then stop working, and I would have to manually redeploy it with

`‘vercel --prod’`

Any alternative?


Jacob Paris (@jacobparis) · 2025-12-03

OIDC tokens are created on-request if they've expired, which should be every 45 minutes 

https://vercel.com/docs/oidc#how-oidc-token-federation-works

Are you working with the tokens manually anywhere that they may be stored? What error do you see that you're fixing with a redeploy?


ashlooz (@ashwinprabou) · 2025-12-03

Hi Jacob! My tokens are currently stored in my env variables. No error currently but the one that I encountered was the following:


```
AI Gateway error response: {"error":{"message":"Error verifying OIDC token\nThe AI Gateway OIDC authentication token is expected to be provided via the 'VERCEL_OIDC_TOKEN' environment variable. It expires every 12 hours.\n- make sure your Vercel project settings have OIDC enabled (already on for new projects by default)\n- if you're running locally with 'vercel dev' the token is automatically obtained and refreshed for you\n- if you're running locally with your own dev server script you can fetch/update the token by running 'vercel env pull'\n- in production or preview the token is automatically obtained and refreshed for you","type":"authentication_error"}}
AI Gateway error: Error: AI Gateway API call failed: Unauthorized
```


ashlooz (@ashwinprabou) · 2025-12-03

12 hours later, running into this issue again, should I not have the token stored manually anymore? Unsure if im missing something in the docs.