<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SafariServices",
  "identifier" : "/documentation/SafariServices/SFAuthenticationSession/CompletionHandler",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "Safari Services",
      "SafariServices"
    ],
    "preciseIdentifier" : "c:@T@SFAuthenticationCompletionHandler"
  },
  "title" : "SFAuthenticationSession.CompletionHandler"
}
-->

# SFAuthenticationSession.CompletionHandler

The completion handler for an authentication session when the user cancels or finishes the login.

```
typealias CompletionHandler = (URL?, (any Error)?) -> Void
```

## Discussion

The custom callback URL should only be a custom URL scheme, and not a standard scheme (e.g. http or https). The session looks at the scheme registered first and routes to the app asking to start a session before potentially routing the scheme to another app.

---

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)