brandTemplate.verifyToken
This API is a preview. Preview APIs are unstable and may change without warning. You can't release public apps using this API until it's stable.
Usage: Extract brand template token from query parameter:
import { brandTemplate, tokenExtractors } from '@canva/app-middleware/express';app.get('/api/template/data', brandTemplate.verifyToken({appId: 'your-app-id',tokenExtractor: tokenExtractors.fromQuery('brand_template_token')}), handler);
Parameters
optionsBrandTemplateAuthOptionsConfiguration options
appIdstringThe ID of the Canva app, obtained via the developer portal canva.com/developers.
tokenExtractorTokenExtractorA function that extracts the brand template JWT token from the request. Unlike user tokens, brand template tokens have no default extractor and must be explicitly configured based on how your app passes the brand template token.
Example
tokenExtractor: tokenExtractors.fromBearerAuth()tokenExtractor: tokenExtractors.fromQuery('brand_template_token')tokenExtractor: tokenExtractors.fromHeader('X-Brand-Template-Token')
Parameters
reqRequestReturns
cacheMaxAgeMinutesnumberThe maximum age of the JWKS cache in minutes.
Default value: 60
timeoutMsnumberThe timeout for the JWKS fetch in milliseconds.
Default value: 30000
baseUrlstringThe base URL for the JWKS endpoint.
Default value: "https://api.canva.com"
Returns
Express middleware that verifies brand template JWT tokens.
RequestHandler