<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKHealthStore/handleAuthorizationForExtension(completion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKHealthStore(im)handleAuthorizationForExtensionWithCompletion:"
  },
  "title" : "handleAuthorizationForExtension(completion:)"
}
-->

# handleAuthorizationForExtension(completion:)

Requests permission to save and read the data types specified by an extension.

```
func handleAuthorizationForExtension(completion: @escaping @Sendable (Bool, (any Error)?) -> Void)
```

## Parameters

`completion`

A block that is called after the user finishes responding to the request. This block is passed the following parameters:

- success: A Boolean value that indicates whether the user responded to the prompt (if any). This value does not indicate whether permission was actually granted. This parameter is <doc://com.apple.documentation/documentation/Swift/false> if the user canceled the prompt without selecting permissions; otherwise, <doc://com.apple.documentation/documentation/Swift/true>.
- error: An error object. If an error occurred, this object contains information about the error; otherwise, it is set to `nil`.

## Discussion

The host app must implement the application delegate’s <doc://com.apple.documentation/documentation/UIKit/UIApplicationDelegate/applicationShouldRequestHealthAuthorization(_:)> method. This delegate method is called after an app extension calls [`requestAuthorization(toShare:read:completion:)`](/documentation/HealthKit/HKHealthStore/requestAuthorization(toShare:read:completion:)). The host app is then responsible for calling [`handleAuthorizationForExtension(completion:)`](/documentation/HealthKit/HKHealthStore/handleAuthorizationForExtension(completion:)). This method prompts the user to authorize both the app and its extensions for the types that the extension requested.

The system performs this request asynchronously. After the user has finished responding, this method calls its completion block on a background queue. If the user has already chosen to grant or prohibit access to all of the types specified, the completion is called without prompting the user.

---

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)