Skip to content
Client
Server

Reference / @open-music-sdk/core / parseToken

Function: parseToken() ​

ts
function parseToken(value): string | undefined;

Defined in: packages/core/src/client.ts:328

value as a token fit to be a header value, or undefined when it is not one: printable ASCII with no spaces or line breaks inside. Whitespace around it, as a token read from a file has, is dropped. This is the one rule for what a token is, for a developer token and a Music User Token alike.

Parameters ​

value ​

unknown

What was given as a token.

Returns ​

string | undefined

The token, trimmed, or undefined when value is not a string of printable ASCII with no spaces or line breaks inside.

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