Skip to content
Client
Server

Reference / @open-music-sdk/browser / tMusicKitInstance

Interface: tMusicKitInstance ​

Defined in: integrations/browser/src/connect.ts:22

What configure gives, as the helper uses it.

Properties ​

developerToken? ​

ts
optional developerToken?: string;

Defined in: integrations/browser/src/connect.ts:26

The developer token the instance was configured with. Whether a configured instance takes a new one is a live check; the helper sets it where it can.


musicUserToken? ​

ts
readonly optional musicUserToken?: string | null;

Defined in: integrations/browser/src/connect.ts:24

The listener's token, when the script holds one: restored for a returning listener, or given by authorize().


unauthorize? ​

ts
optional unauthorize?: () => unknown;

Defined in: integrations/browser/src/connect.ts:37

Apple's own sign-out, where the instance has one: ends the sign-in in the script, the copy of the token it kept, and the token at Apple.

Returns ​

unknown

Methods ​

authorize() ​

ts
authorize(): Promise<string | null | undefined>;

Defined in: integrations/browser/src/connect.ts:35

Apple's own: opens the sign-in window.

Returns ​

Promise<string | null | undefined>

The Music User Token, or nothing.

Throws ​

An error named AUTHORIZATION_ERROR when the listener declines or closes the window, which the helper takes for a decline; and whatever else Apple's script rejects with when the window cannot be opened or the sign-in fails, which the helper hands on as it came.

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