---
title: "init(url:callback:completionHandler:)"
framework: authenticationservices
role: symbol
role_heading: Initializer
path: "authenticationservices/aswebauthenticationsession/init(url:callback:completionhandler:)-6nut7"
---

# init(url:callback:completionHandler:)

Creates a web authentication session instance that uses a callback to evaluate a redirection URL.

## Declaration

```swift
init(url URL: URL, callback: ASWebAuthenticationSession.Callback, completionHandler: @escaping ASWebAuthenticationSession.CompletionHandler)
```

## Parameters

- `URL`: The initial URL pointing to the authentication webpage. This initializer only supports URLs with http:// or https:// schemes.
- `callback`: An object that describes when the session calls its completion handler.
- `completionHandler`: A completion handler that the system calls when the session completes successfully, or when the person using the app cancels the request.

## Discussion

Discussion The following example creates a session that requires a callback with a custom URL scheme, using the customScheme(_:) type method to create the callback parameter: let session = ASWebAuthenticationSession(     url: URL(string: "https://example.com/oauth/login/authorize")!,     callback: .customScheme("myappscheme") ) { callbackURL, error in     // Handle the session result. }

## See Also

### Creating a session

- [ASWebAuthenticationSession.Callback](authenticationservices/aswebauthenticationsession/callback.md)
- [ASWebAuthenticationSession.CompletionHandler](authenticationservices/aswebauthenticationsession/completionhandler.md)
