Skip to content
Client
Server

Reference / @open-music-sdk/user-token / tUserTokenIntake

Type Alias: tUserTokenIntake ​

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

Defined in: user-token/src/intake.ts:34

A web-standard handler, to mount wherever your framework takes one.

Parameters ​

req ​

Request

The request as the platform hands it over.

Returns ​

Promise<Response>

204 with no body once the token is accepted and stored; otherwise { "error": "<tag>" } with the status that says what was wrong with the request, or that Apple refused or could not be asked.

Throws ​

Whatever userId or the store rejects with, and a TypeError when userId resolves to something that is no string. These are the app's own failures, and yours to answer.

Throws ​

Whatever a token provider, hook or rate limiter throws, as client.request passes it on, and whatever the runtime rejects with when the body cannot be read.

Throws ​

The reason req.signal aborted with, when it does.

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