Provide auth tokens for key server requests using the keyServerAuth callback. Called before every key fetch.
If your key server requires authentication, provide the keyServerAuth callback. The player calls it before every key request and attaches the returned token as a Bearer header.
Basic setup
import { createPlayer } from "@blindcast/player"const result = createPlayer(videoEl, { keyServerUrl: "https://keys.example.com/keys", keyServerAuth: async () => { // Return the raw token — the player prepends "Bearer " return getAccessToken() // e.g., "eyJhbGciOiJIUzI1NiI..." },})
The callback is async, so you can fetch or refresh tokens before returning:
The player encounters an EXT-X-KEY tag in the manifest
Before fetching the key, it calls your keyServerAuth() function
The returned string is sent as Authorization: Bearer <token>
If the key server returns 401 or 403, the player emits a KEY_AUTH_FAILED error
Error handling
player.on("error", (err) => { if (err.code === "KEY_AUTH_FAILED") { // Token is invalid or expired — prompt re-login redirectToLogin() }})
Never log the token returned by keyServerAuth. The player does not include tokens in error messages or metrics.
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"BlindCast","colors":{"primary":"#6366f1","light":"#818cf8","dark":"#4f46e5"},"logo":{"light":"https://mintcdn.com/stillwaterstudio/gwkQ_H6ySS15AoKG/logo/light.svg?fit=max\u0026auto=format\u0026n=gwkQ_H6ySS15AoKG\u0026q=85\u0026s=8d7ce2337dcfa5512cbd46720cb22051","dark":"https://mintcdn.com/stillwaterstudio/gwkQ_H6ySS15AoKG/logo/dark.svg?fit=max\u0026auto=format\u0026n=gwkQ_H6ySS15AoKG\u0026q=85\u0026s=efdadcec987ceeae77bc75f81d7747e0"},"favicon":"/favicon.svg","styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"stillwaterstudio","hasAudioNarration":false,"actualSubdomain":"stillwaterstudio","customDomains":["docs.blindcast.dev"],"gitSource":{"type":"github","owner":"gunwooterry","repo":"blindcast","deployBranch":"main","contentDirectory":"packages/docs","isPrivate":true,"mountPath":"","label":"","_id":"6b10d65d9ffae5051c40d421"},"entitlements":{},"buildId":"6ae948a94e1e9c8ee81b1dab:success","clientVersion":"0.0.4428","searchFilterCounts":[{"language":"default","tag":"CLI","count":6},{"language":"default","tag":"Server","count":6},{"language":"default","tag":"Key Server","count":5},{"language":"default","tag":"Player","count":5},{"language":"default","tag":"Going to Production","count":4},{"language":"default","tag":"Uploader","count":4},{"language":"default","tag":"Getting Started","count":3},{"language":"default","tag":"Introduction","count":3},{"language":"default","tag":"Reference","count":2},{"language":"default","tag":"Serverless","count":2}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"auth-vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"player/authentication","slug":"/player/authentication","pageMetadata":{"title":"Authentication","description":"Provide auth tokens for key server requests using the keyServerAuth callback. Called before every key fetch.","href":"/player/authentication","hidden":false},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Provide auth tokens for key server requests using the keyServerAuth callback. Called before every key fetch.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`If your key server requires authentication, provide the `,_jsx(_components.code,{children:`keyServerAuth`}),` callback. The player calls it before every key request and attaches the returned token as a `,_jsx(_components.code,{children:`Bearer`}),` header.`]}),`\n`,_jsx(Heading,{level:`2`,id:`basic-setup`,children:`Basic setup`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`createPlayer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@blindcast/player\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` result`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createPlayer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`videoEl`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` keyServerUrl:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://keys.example.com/keys\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` keyServerAuth`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` () `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Return the raw token — the player prepends \"Bearer \"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` getAccessToken`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// e.g., \"eyJhbGciOiJIUzI1NiI...\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The callback is `,_jsx(_components.code,{children:`async`}),`, so you can fetch or refresh tokens before returning:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#C8C8C8`},children:`keyServerAuth`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` () `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`isTokenExpired`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`currentToken`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` currentToken`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` refreshToken`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` currentToken`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`how-it-works`,children:`How it works`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`The player encounters an `,_jsx(_components.code,{children:`EXT-X-KEY`}),` tag in the manifest`]}),`\n`,_jsxs(_components.li,{children:[`Before fetching the key, it calls your `,_jsx(_components.code,{children:`keyServerAuth()`}),` function`]}),`\n`,_jsxs(_components.li,{children:[`The returned string is sent as `,_jsx(_components.code,{children:`Authorization: Bearer \u003ctoken>`})]}),`\n`,_jsxs(_components.li,{children:[`If the key server returns 401 or 403, the player emits a `,_jsx(_components.code,{children:`KEY_AUTH_FAILED`}),` error`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`error-handling`,children:`Error handling`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`player`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`on`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`err`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`err`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`code`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"KEY_AUTH_FAILED\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Token is invalid or expired — prompt re-login`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` redirectToLogin`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Never log the token returned by `,_jsx(_components.code,{children:`keyServerAuth`}),`. The player does not include tokens in error messages or metrics.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Authentication","description":"Provide auth tokens for key server requests using the keyServerAuth callback. Called before every key fetch.","href":"/player/authentication","hidden":false}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Basic setup","slug":"basic-setup","depth":2,"children":[]},{"title":"How it works","slug":"how-it-works","depth":2,"children":[]},{"title":"Error handling","slug":"error-handling","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"stillwaterstudio","siteName":"BlindCast","title":"Authentication - BlindCast","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-02-27T03:01:02.253Z","originalFileLocation":"player/authentication.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Provide auth tokens for key server requests using the keyServerAuth callback. Called before every key fetch.\">\u003cmeta data-mint-head name=\"application-name\" content=\"BlindCast\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/stillwaterstudio/865jUXWyg45zLT1s/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/stillwaterstudio/865jUXWyg45zLT1s/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/stillwaterstudio/865jUXWyg45zLT1s/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/stillwaterstudio/865jUXWyg45zLT1s/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/stillwaterstudio/865jUXWyg45zLT1s/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/stillwaterstudio/865jUXWyg45zLT1s/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/stillwaterstudio/865jUXWyg45zLT1s/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/stillwaterstudio/865jUXWyg45zLT1s/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/stillwaterstudio/865jUXWyg45zLT1s/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Authentication - BlindCast\">\u003cmeta data-mint-head property=\"og:description\" content=\"Provide auth tokens for key server requests using the keyServerAuth callback. Called before every key fetch.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"BlindCast\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.blindcast.dev/player/authentication\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://stillwaterstudio.mintlify.site/_mintlify/api/og/v2?division=Player\u0026amp;title=Authentication\u0026amp;description=Provide+auth+tokens+for+key+server+requests+using+the+keyServerAuth+callback.+Called+before+every+key+fetch.\u0026amp;theme=16717094e78f745cc65ef082\u0026amp;signature=efc80eb898eca51353862e49892e5ac1fba0e6faae7d6c53ec55fab133fe7660\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Authentication - BlindCast\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Provide auth tokens for key server requests using the keyServerAuth callback. Called before every key fetch.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://stillwaterstudio.mintlify.site/_mintlify/api/og/v2?division=Player\u0026amp;title=Authentication\u0026amp;description=Provide+auth+tokens+for+key+server+requests+using+the+keyServerAuth+callback.+Called+before+every+key+fetch.\u0026amp;theme=16717094e78f745cc65ef082\u0026amp;signature=efc80eb898eca51353862e49892e5ac1fba0e6faae7d6c53ec55fab133fe7660\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/stillwaterstudio/865jUXWyg45zLT1s/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"BlindCast\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#6366f1\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.blindcast.dev/player/authentication\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/player/authentication.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.blindcast.dev/#organization\",\"name\":\"BlindCast\",\"url\":\"https://docs.blindcast.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/stillwaterstudio/gwkQ_H6ySS15AoKG/logo/light.svg?fit=max\u0026auto=format\u0026n=gwkQ_H6ySS15AoKG\u0026q=85\u0026s=8d7ce2337dcfa5512cbd46720cb22051\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.blindcast.dev#website\",\"name\":\"BlindCast\",\"url\":\"https://docs.blindcast.dev\",\"publisher\":{\"@id\":\"https://docs.blindcast.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.blindcast.dev/player/authentication#webpage\",\"url\":\"https://docs.blindcast.dev/player/authentication\",\"name\":\"Authentication\",\"description\":\"Provide auth tokens for key server requests using the keyServerAuth callback. Called before every key fetch.\",\"dateModified\":\"2026-02-27T03:01:02.253Z\",\"isPartOf\":{\"@id\":\"https://docs.blindcast.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.blindcast.dev/player/authentication#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.blindcast.dev/player/authentication#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Player\",\"item\":\"https://docs.blindcast.dev/player/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Authentication\",\"item\":\"https://docs.blindcast.dev/player/authentication\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.blindcast.dev/player/authentication#article\",\"headline\":\"Authentication\",\"name\":\"Authentication\",\"description\":\"Provide auth tokens for key server requests using the keyServerAuth callback. Called before every key fetch.\",\"url\":\"https://docs.blindcast.dev/player/authentication\",\"mainEntityOfPage\":{\"@id\":\"https://docs.blindcast.dev/player/authentication#webpage\"},\"dateModified\":\"2026-02-27T03:01:02.253Z\",\"publisher\":{\"@id\":\"https://docs.blindcast.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.blindcast.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"BlindCast\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"BlindCast\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/player/authentication.md","siteName":"BlindCast","nav":{"global":null,"groups":[{"group":"Introduction","pages":[{"title":"What is BlindCast?","href":"/introduction/what-is-blindcast"},{"title":"Zero-Knowledge Explained","href":"/introduction/zero-knowledge-explained"},{"title":"Architecture Overview","href":"/introduction/architecture-overview"}]},{"group":"Getting Started","pages":[{"title":"Installation","href":"/getting-started/installation"},{"title":"Quick Start","href":"/getting-started/quick-start"},{"title":"Migrating from Package Imports","href":"/getting-started/migration"}]},{"group":"Server","pages":[{"title":"Server Overview","href":"/server/overview"},{"title":"Docker Setup","href":"/server/docker"},{"title":"Reverse Proxy","href":"/server/reverse-proxy"},{"title":"Content API","href":"/server/content-api"},{"title":"API Keys","href":"/server/api-keys"},{"title":"Admin Dashboard","href":"/server/admin-dashboard"}]},{"group":"Player","pages":[{"title":"Player Overview","href":"/player/overview"},{"title":"Basic Usage","description":"Create a player, load a manifest, listen to events, read metrics, and clean up when done.","href":"/player/basic-usage"},{"title":"Authentication","href":"/player/authentication"},{"title":"Lease-Based Revocation","description":"Revoke a viewer's access without re-encrypting content using time-limited leases that the player renews automatically.","href":"/player/leases"},{"title":"API Reference","href":"/player/api-reference"}]},{"group":"CLI","pages":[{"title":"CLI Overview","href":"/cli/overview"},{"title":"blindcast init","href":"/cli/init"},{"title":"blindcast keygen","href":"/cli/keygen"},{"title":"blindcast encrypt","href":"/cli/encrypt"},{"title":"blindcast upload","href":"/cli/upload"},{"title":"blindcast serve","href":"/cli/serve"}]},{"group":"Uploader","pages":[{"title":"Uploader Overview","href":"/uploader/overview"},{"title":"Basic Usage","href":"/uploader/basic-usage"},{"title":"Progress \u0026 Abort","href":"/uploader/progress-and-abort"},{"title":"API Reference","href":"/uploader/api-reference"}]},{"group":"Key Server","pages":[{"title":"Key Server Overview","href":"/key-server/overview"},{"title":"Configuration","href":"/key-server/configuration"},{"title":"Database","href":"/key-server/database"},{"title":"Presign Endpoint","href":"/key-server/presign"},{"title":"Leases \u0026 Revocation","href":"/key-server/leases"}]},{"group":"Serverless","pages":[{"title":"Cloudflare Workers","href":"/serverless/cloudflare-workers"},{"title":"AWS Lambda","href":"/serverless/aws-lambda"}]},{"group":"Going to Production","pages":[{"title":"Production Checklist","href":"/production/checklist"},{"title":"CDN Configuration","href":"/production/cdn"},{"title":"Key Rotation","href":"/production/key-rotation"},{"title":"Monitoring","href":"/production/monitoring"}]},{"group":"Reference","pages":[{"title":"Error Codes","href":"/reference/error-codes"},{"title":"Result Type Pattern","href":"/reference/result-type-pattern"}]}]},"basePath":"","title":"Authentication - BlindCast","deploymentId":"dpl_4dgnk6TA5fUgboKHTvWWyeqm3idh","buildId":"dpl_4dgnk6TA5fUgboKHTvWWyeqm3idh","dynamics":[],"chunks":[]}