Skip to content
Client
Server

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

Interface: tUserTokenStore ​

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

Where forUser(userId) finds a listener's Music User Token. The client reads it, through get, each time a request of that listener's needs the token; set and delete are for whoever signs listeners in and out, such as an integration, and the client needs them to be there without calling them.

Methods ​

delete() ​

ts
delete(userId): Promise<void>;

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

Forgets a listener's token, if one is stored.

Parameters ​

userId ​

string

Whose token, under the name the app knows the listener by.

Returns ​

Promise<void>


get() ​

ts
get(userId): Promise<string | undefined>;

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

The listener's token, or undefined when none is stored: the request then rejects with a UserTokenInvalid. What it rejects with, the request that asked rejects with, as it is.

Parameters ​

userId ​

string

Whose token, under the name the app knows the listener by.

Returns ​

Promise<string | undefined>

The token, or undefined for a listener with none.


set() ​

ts
set(userId, token): Promise<void>;

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

Keeps a listener's token, in place of any stored before.

Parameters ​

userId ​

string

Whose token, under the name the app knows the listener by.

token ​

string

The Music User Token to keep.

Returns ​

Promise<void>

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