Skip to content

Feat: Add user library endpoint and unofficial user token support#4

Open
daimoxd wants to merge 2 commits into
sync-fm:mainfrom
daimoxd:feat/user-auth-library
Open

Feat: Add user library endpoint and unofficial user token support#4
daimoxd wants to merge 2 commits into
sync-fm:mainfrom
daimoxd:feat/user-auth-library

Conversation

@daimoxd
Copy link
Copy Markdown

@daimoxd daimoxd commented Jun 5, 2026

Description:

This pull request introduces the Library endpoint ( /v1/me/library ) to access the
user's authenticated content (albums, playlists, songs) and adds unofficial user
token authorization header management.

Changes:

• src/endpoints/Library/index.ts : Implements the LibraryEndpoint with getAlbums ,
getPlaylists , and getSongs fetching capabilities.
• src/AppleMusic.ts : Integrates the library endpoint property and handles its
initialization on init() .
• src/utils/Config.ts & src/utils/AxiosManager.ts : Adds support for custom
userToken configuration and injects the Music-User-Token header automatically when
AuthType.UserTokenUnofficial is active.
• src/index.ts : Exports LibraryEndpoint globally.
• src/endpoints/Library/index.test.ts : Unit test suite achieving 100% test coverage
on library requests.

Examples of usage:

import { AppleMusic, AuthType } from "@syncfm/applemusic-api";

const client = new AppleMusic({
  authType: AuthType.UserTokenUnofficial,
  userToken: "YOUR_MUSIC_USER_TOKEN_HERE"
});

await client.init();

// Fetch personal library items
const librarySongs = await client.Library.getSongs(25, 0);
console.log("Songs:", librarySongs);

const libraryAlbums = await client.Library.getAlbums(10, 0);
console.log("Albums:", libraryAlbums);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant