Skip to content
Client
Server

Reference / @open-music-sdk/react / tUseConnect

Interface: tUseConnect ​

Defined in: integrations/react/src/client.ts:130

What useConnect gives: where the sign-in stands, and the two functions, each keeping its identity.

Properties ​

connect ​

ts
readonly connect: () => Promise<string | undefined>;

Defined in: integrations/react/src/client.ts:141

Opens Apple's sign-in window, to be called inside the click, and resolves to the Music User Token, which the provider now holds too, or to undefined when the script answered with nothing. After a ready that failed it loads and configures the script afresh. Rejects with what the helper's connect() rejects with, after putting it in error; called before the component mounted or after it unmounted, it is a TypeError.

Returns ​

Promise<string | undefined>


disconnect ​

ts
readonly disconnect: () => Promise<void>;

Defined in: integrations/react/src/client.ts:149

Signs out: Apple's own sign-out through the script, so a later page load restores nothing, and the provider forgets the token. The script's sign-out ends the token at Apple too, as it did against the live API on 18 October 2026, and with it any copy your server stored. Rejects with what the helper's disconnect() rejects with, and the token is then kept; called before the component mounted or after it unmounted, it is a TypeError.

Returns ​

Promise<void>


error ​

ts
readonly error: unknown;

Defined in: integrations/react/src/client.ts:134

Why it is not, when it cannot be: what the helper's ready rejected with, or what the last connect() failed with.


isReady ​

ts
readonly isReady: boolean;

Defined in: integrations/react/src/client.ts:132

Whether Apple's script is loaded and configured: when the button can be enabled.

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