Quickstart
Install API OIDC, trust your platform's tokens, and send the first one to the Delivery API.
-
Install the package in your Umbraco site:
dotnet add package TheBuilder.ApiOidc -
Make sure your
Program.cscallsAddDeliveryApi()beforeAddComposers(), as Umbraco’s template does. The package replaces the Delivery API’s access check, so it has to come after it. -
List the issuers you trust:
{ "Umbraco": { "CMS": { "DeliveryApi": { "Enabled": true, "PublicAccess": false } } }, "ApiOidc": { "Issuers": [ { "Preset": "Vercel", "Team": "acme" } ] } } -
Send the token in the
X-Oidc-Tokenheader with each Delivery API request. On Vercel:import { getVercelOidcToken } from '@vercel/oidc'; const response = await fetch(`${process.env.UMBRACO_URL}/umbraco/delivery/api/v2/content`, { headers: { 'X-Oidc-Token': await getVercelOidcToken() }, }); -
Once no frontend sends the
Api-Keyheader any more, removeUmbraco:CMS:DeliveryApi:ApiKey.
Next
- Issuers covers GitHub Actions, Google Cloud, AWS, GitLab and the rest of the Vercel settings.
- Custom endpoints protects your own APIs with the same tokens.