<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MusicKit",
  "identifier" : "/documentation/MusicKit/MusicUserTokenProvider",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "MusicKit"
    ],
    "preciseIdentifier" : "s:8MusicKit0A17UserTokenProviderC"
  },
  "title" : "MusicUserTokenProvider"
}
-->

# MusicUserTokenProvider

A class that music requests use to fetch user tokens your app requires
to access Apple Music API.

```
class MusicUserTokenProvider
```

## Topics

### Initializers

[`init()`](/documentation/MusicKit/MusicUserTokenProvider/init())

Creates a user token provider.

### Instance Methods

[`func userToken(for: String, options: MusicTokenRequestOptions) async throws -> String`](/documentation/MusicKit/MusicUserTokenProvider/userToken(for:options:))

Fetches and returns a user token for Apple Music API.

## Relationships

### Inherited By

[`DefaultMusicTokenProvider`](/documentation/MusicKit/DefaultMusicTokenProvider)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)