From b9229f21d650d1cc8ac27d4a226267de12a23582 Mon Sep 17 00:00:00 2001 From: Ranbel Sun Date: Mon, 28 Apr 2025 17:12:55 -0400 Subject: [PATCH 1/2] send service token in one header --- .../identity/service-tokens.mdx | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/content/docs/cloudflare-one/identity/service-tokens.mdx b/src/content/docs/cloudflare-one/identity/service-tokens.mdx index 6eae9884229482..872ad9987ba92c 100644 --- a/src/content/docs/cloudflare-one/identity/service-tokens.mdx +++ b/src/content/docs/cloudflare-one/identity/service-tokens.mdx @@ -5,7 +5,7 @@ sidebar: order: 6 --- -import { AvailableNotifications, Render } from "~/components"; +import { AvailableNotifications, Render, APIRequest } from "~/components"; You can provide automated systems with service tokens to authenticate against your Zero Trust policies. Cloudflare Access will generate service tokens that consist of a Client ID and a Client Secret. Automated systems or applications can then use these values to reach an application protected by Access. @@ -35,6 +35,31 @@ curl -H "CF-Access-Client-Id: " -H "CF-Access-Client-Secret: + +2. Add the header to any HTTP request. For example, + + ```sh + curl -H "Authorization: {"CF-Access-Client-Id": "", "CF_Access-Client-Secret": ""}" https://app.example.com + ``` + ### Subsequent requests After you have [authenticated to the application](#initial-request) using the service token, add the resulting `CF_Authorization` cookie to the headers of all subsequent requests: From cd7dd282d0046a3bb7e05bc59ba87ac8e07f1d91 Mon Sep 17 00:00:00 2001 From: Ranbel Sun Date: Mon, 28 Apr 2025 17:47:57 -0400 Subject: [PATCH 2/2] clarify PUT request body --- .../docs/cloudflare-one/identity/service-tokens.mdx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/content/docs/cloudflare-one/identity/service-tokens.mdx b/src/content/docs/cloudflare-one/identity/service-tokens.mdx index 872ad9987ba92c..47a5da52f95443 100644 --- a/src/content/docs/cloudflare-one/identity/service-tokens.mdx +++ b/src/content/docs/cloudflare-one/identity/service-tokens.mdx @@ -41,7 +41,14 @@ You can configure a self-hosted Access application to accept a service token in To authenticate using a single header: -1. In your Access application, specify the name of the header you want to use for service token authentication: +1. Get your existing Access application configuration: + + + +2. Make a `PUT` request with the name of the header you want to use for service token authentication. To avoid overwriting your existing configuration, the `PUT` request body should contain all fields returned by the previous `GET` request. 2. Add the header to any HTTP request. For example,