JWT secret - accessing it in Netlify functions

Hello. We’re looking at using role based redirects and using our own external JWT provider. I just have one question about the secret that you set for the JWT token via the netlify UI. Is it possible to access this in a Netlify function somehow, like you could the environment variables that you can set in the UI?


I’ve responded in the Helpdesk but, for posterity, using clientContext is how you can make that happen! :slight_smile:

That’ll spare you having to parse the variable elsewhere.

Hi. I’m not sure if this is right in my case. I’m not using Netlify Identity - we’re using role-based redirects with an external party which only works if you disable netlify identity. When I inspect the clientContext it doesn’t appear to have what I need - as in the JWT secret I’ve saved in the netlify UI.


You’re right, that’s only populated when using Identity. In which case, perhaps following along with something like this would be the best course of action?

This little module will act as a wrapper to populate a similar context for you to make use of!