---
title: requestAuthorization()
framework: wifiinfrastructure
role: symbol
role_heading: Instance Method
path: wifiinfrastructure/winetworksharingcontroller/requestauthorization()
---

# requestAuthorization()

Requests network-sharing authorization for the specified accessory at initial setup.

## Declaration

```swift
func requestAuthorization() async throws -> WINetworkSharingController.AuthorizationState
```

## Return Value

Return Value An WINetworkSharingController.AuthorizationState value indicating the authorization level the person selected.

## Discussion

Discussion Call this method to request that the system ask the person to authorize sharing of Wi-Fi networks to the specified accessory. The person or the system may decline the request. The person can select from the following sharing modes: Automatically Share: The system automatically sends new networks to the accessory when the device joins them while the accessory is connected. Ask Every Time: When the device joins a new network, the system notifies your extension through the Wi-Fi Infrastructure framework. Your extension can then check newShareableNetworkAvailable and call presentAskToShareUI(scanProvider:) to present UI asking the person to share that network. Don’t Share: The person declines to share Wi-Fi networks with this accessory. In the “Automatically Share” and “Ask Every Time” sharing modes, the accessory may request to share a nearby network that’s known to the person. Accessories can use this to prompt a person to share a different network if they have trouble connecting to a previously shared network. note: accessoryTransportNotSecured if the accessory is not using a secure Bluetooth transport. accessoryNotConnected if the accessory isn’t connected when your container app calls this method. WINetworkSharingError if other faults occur.

## See Also

### Authorizing an accessory for network sharing

- [WINetworkSharingController.AuthorizationState](wifiinfrastructure/winetworksharingcontroller/authorizationstate.md)
