design.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 design token from query parameter:
import { design, tokenExtractors } from '@canva/app-middleware/express';app.get('/api/design/data', design.verifyToken({appId: 'your-app-id',tokenExtractor: tokenExtractors.fromQuery('design_token')}), handler);
Parameters
optionsDesignAuthOptionsConfiguration options
appIdstringThe ID of the Canva app, obtained via the developer portal canva.com/developers.
tokenExtractorTokenExtractorA function that extracts the design JWT token from the request. Unlike user tokens, design tokens have no default extractor and must be explicitly configured based on how your app passes the design token.
Example
tokenExtractor: tokenExtractors.fromBearerAuth()tokenExtractor: tokenExtractors.fromQuery('design_token')tokenExtractor: tokenExtractors.fromHeader('X-Design-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 design JWT tokens.
RequestHandler