---
title: HKError.Code.errorAuthorizationDenied
framework: healthkit
role: symbol
role_heading: Case
path: healthkit/hkerror/code/errorauthorizationdenied
---

# HKError.Code.errorAuthorizationDenied

The user hasn’t given the app permission to save data.

## Declaration

```swift
case errorAuthorizationDenied
```

## Mentioned in

Authorizing access to health data

## Discussion

Discussion This error occurs only when your app attempts to save data. If your app isn’t authorized to query data, it receives only the data that the app has saved into HealthKit. For more information on setting up HealthKit, see HealthKit.

## See Also

### Errors

- [HKError.Code.errorHealthDataUnavailable](healthkit/hkerror/code/errorhealthdataunavailable.md)
- [HKError.Code.errorHealthDataRestricted](healthkit/hkerror/code/errorhealthdatarestricted.md)
- [HKError.Code.errorInvalidArgument](healthkit/hkerror/code/errorinvalidargument.md)
- [HKError.Code.errorAuthorizationNotDetermined](healthkit/hkerror/code/errorauthorizationnotdetermined.md)
- [HKError.Code.errorRequiredAuthorizationDenied](healthkit/hkerror/code/errorrequiredauthorizationdenied.md)
- [HKError.Code.errorDatabaseInaccessible](healthkit/hkerror/code/errordatabaseinaccessible.md)
- [HKError.Code.errorUserCanceled](healthkit/hkerror/code/errorusercanceled.md)
- [HKError.Code.errorAnotherWorkoutSessionStarted](healthkit/hkerror/code/erroranotherworkoutsessionstarted.md)
- [HKError.Code.errorUserExitedWorkoutSession](healthkit/hkerror/code/erroruserexitedworkoutsession.md)
- [HKError.Code.errorNoData](healthkit/hkerror/code/errornodata.md)
