AppleMusicAPI.Token (apple_music_api v0.3.0)

Copy Markdown View Source

Apple Music API token generation.

Apple Music uses a developer token (JWT) for catalog access and optionally a user token for library access. The developer token is signed ES256 and contains the team ID and key ID.

Summary

Functions

Generate the Apple Music developer token for API access.

Like access_token/1 but also returns the unix-epoch expiry time, for cache use.

Build and sign the Apple Music developer token (ES256).

Types

jwt()

@type jwt() :: String.t()

Functions

access_token(opts \\ [])

@spec access_token(keyword()) :: {:ok, String.t()} | {:error, term()}

Generate the Apple Music developer token for API access.

access_token_with_expiry(opts \\ [])

@spec access_token_with_expiry(keyword()) ::
  {:ok, String.t(), integer()} | {:error, term()}

Like access_token/1 but also returns the unix-epoch expiry time, for cache use.

generate_jwt(opts \\ [])

@spec generate_jwt(keyword()) :: {:ok, jwt()} | {:error, term()}

Build and sign the Apple Music developer token (ES256).