---
title: "requestAuthorization(for:handler:)"
framework: photos
role: symbol
role_heading: Type Method
path: "photos/phphotolibrary/requestauthorization(for:handler:)"
---

# requestAuthorization(for:handler:)

Prompts the user to grant the app permission to access the photo library.

## Declaration

```swift
class func requestAuthorization(for accessLevel: PHAccessLevel, handler: @escaping @Sendable (PHAuthorizationStatus) -> Void)
```

```swift
class func requestAuthorization(for accessLevel: PHAccessLevel) async -> PHAuthorizationStatus
```

## Parameters

- `accessLevel`: The access level to request.
- `handler`: The callback the system invokes when it’s made a determination of the app’s status.

## Mentioned in

Delivering an Enhanced Privacy Experience in Your Photos App Uploading asset resources in the background

## Discussion

Discussion For more information about accessing the user’s Photos library, see Delivering an Enhanced Privacy Experience in Your Photos App.

## See Also

### Verifying Authorization

- [authorizationStatus(for:)](photos/phphotolibrary/authorizationstatus(for:).md)
- [PHAccessLevel](photos/phaccesslevel.md)
- [PHAuthorizationStatus](photos/phauthorizationstatus.md)
- [authorizationStatus()](photos/phphotolibrary/authorizationstatus().md)
- [requestAuthorization(_:)](photos/phphotolibrary/requestauthorization(_:).md)
