You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/cloudflare-one/identity/authorization-cookie/validating-json.mdx
+57-5Lines changed: 57 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,6 +102,62 @@ To get the AUD tag:
102
102
103
103
You can now paste the AUD tag into your token validation script. The AUD tag will never change unless you delete or recreate the Access application.
104
104
105
+
### Cloudflare Workers example
106
+
107
+
When Cloudflare Access is in front of your [Worker](/workers), your Worker still needs to validate the JWT that Cloudflare Access adds to the `Cf-Access-Jwt-Assertion` header on the incoming request.
108
+
109
+
The following code will validate the JWT using the [jose NPM package](https://www.npmjs.com/package/jose):
Add these [environment variables](/workers/configuration/environment-variables/) to your Worker:
156
+
- `POLICY_AUD`: Your application's [AUD tag](#get-your-aud-tag)
157
+
- `TEAM_DOMAIN`: `https://<your-team-name>.cloudflareaccess.com`, where `<your-team-name>` is replaced with your actual <GlossaryTooltipterm="team name">team name</GlossaryTooltip>.
158
+
159
+
You can set these variables by adding them to your Worker's [Wrangler configuration file](/workers/wrangler/configuration/), or via the Cloudflare dashboard under **Workers & Pages** > **your-worker** > **Settings** > **Environment Variables**.
160
+
105
161
### Golang example
106
162
107
163
```go
@@ -246,7 +302,7 @@ if __name__ == '__main__':
246
302
app.run()
247
303
```
248
304
249
-
### JavaScript example
305
+
### JavaScript (Node.js) example
250
306
251
307
```javascript
252
308
constexpress=require("express");
@@ -292,7 +348,3 @@ app.get("/", (req, res) => {
292
348
293
349
app.listen(3333);
294
350
```
295
-
296
-
## Related resources
297
-
298
-
-[Verifying JWTs in Cloudflare Workers](https://kinde.com/blog/engineering/verifying-jwts-in-cloudflare-workers/) - Implement JWT verification in Cloudflare Workers.
0 commit comments