Dunfey · Hotel WWDC as data, est. 1983
Front desk everything
Years
Topics

2021 Privacy & Security

WWDC21 · 8 min · Privacy & Security

Simplify sign in for your tvOS apps

Find out how people can use Face ID or Touch ID on their iOS or iPadOS device to authorize purchases and sign into your tvOS app. Discover how you can simplify sign in for people using your app and help them get to the content they want to enjoy, faster. We’ll show you how to set up a simplified sign in process and share some best practices about creating great sign in experiences for Apple TV. To get the most out of this session, we recommend a basic understanding of associated domains and the Authentication Services framework.

Watch at developer.apple.com ↗

Transcript all transcripts

Code shown on screen · 4 snippets

Request a credential swift · at 3:28 ↗
let controller = ASAuthorizationController(authorizationRequests: [
    ASAuthorizationPasswordProvider().createRequest()
])

controller.delegate = self
controller.performRequests()
Finish signing in swift · at 4:19 ↗
func authorizationController(controller: ASAuthorizationController,
    didCompleteWithAuthorization authorization: ASAuthorization) {
    if let credential = authorization.credential as? ASPasswordCredential {
        // Use the credential to sign in
    }
}
Handle errors swift · at 4:43 ↗
func authorizationController(controller: ASAuthorizationController,
    didCompleteWithError error: Error) {
    if case ASAuthorizationError.canceled = error  { return }
    // Let the user know something went wrong
}
Specify custom authorization methods swift · at 6:00 ↗
controller.customAuthorizationMethods = [
    // Sign in Manually
    .other,
    // Restore Purchase
    .restorePurchase
]

Resources