<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MediaDevice",
  "identifier" : "/documentation/MediaDevice/MediaDeviceRoutingManager/requestPairingCode(for:session:reason:authorizationMethod:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Media Device"
    ],
    "preciseIdentifier" : "s:11MediaDevice0aB14RoutingManagerC18requestPairingCode3for7session6reason19authorizationMethodyAA0a6OutputB0V_AA0aM7SessionC10Foundation23LocalizedStringResourceVAJ013AuthorizationL0VtF"
  },
  "title" : "requestPairingCode(for:session:reason:authorizationMethod:)"
}
-->

# requestPairingCode(for:session:reason:authorizationMethod:)

Presents a pairing user interface so the user can enter authorization credentials for a device.

```
@MainActor final func requestPairingCode(for device: MediaOutputDevice, session: MediaOutputSession, reason: LocalizedStringResource, authorizationMethod: MediaOutputDevice.AuthorizationMethod)
```

## Parameters

`device`

The device needing authorization.

`session`

The session associated with the pairing request.

`reason`

The reason why the user is being asked to input authorization.

`authorizationMethod`

The type of authorization user interface to present to the user.

## Discussion

Call this function when the session requires user input for pairing.

---

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)