Skip to content
Client
Server

Reference / @open-music-sdk/server / tTokenEndpoint

Type Alias: tTokenEndpoint ​

ts
type tTokenEndpoint = (req) => Promise<Response>;

Defined in: integrations/server/src/token-endpoint.ts:26

A web-standard handler, to mount wherever your framework takes one: export const GET = tokenEndpoint(…).

Parameters ​

req ​

Request

The request as the framework hands it over; its method and Origin header are read.

Returns ​

Promise<Response>

The answer: the token as JSON for a GET, 204 for OPTIONS, 405 for any other method.

Throws ​

TypeError if the first mint finds the pem is no key: the minter's own, inside the request, since the handler catches nothing.

MIT licensed. Not affiliated with, endorsed by, or sponsored by Apple Inc. Apple Music and MusicKit are trademarks of Apple Inc.