View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vídeos

Abrir menu Fechar menu
  • Coleções
  • Todos os vídeos
  • Sobre

Mais vídeos

  • Sobre
  • Código
  • Enhance your Sign in with Apple experience

    Learn how you can provide safe and fast authentication in your app using Sign in with Apple. We'll show you how you can upgrade password-based accounts into secure, single-tap login credentials, and explore how you can seamlessly handle changes to user sessions in your app. We'll also help you take advantage of Sign In with Apple across the web and on other platforms.

    To get the most out of this session, we recommend having familiarity with Sign In with Apple and REST API. We'd also recommend having a basic understanding of JavaScript.

    Recursos

    • Token revocation
    • Sign in with Apple Button
    • Implementing User Authentication with Sign in with Apple
      • Vídeo HD
      • Vídeo SD

    Vídeos relacionados

    WWDC22

    • Discover Sign in with Apple at Work & School
    • Meet passkeys

    WWDC20

    • Get the most out of Sign in with Apple
    • One-tap account security upgrades
  • Buscar neste vídeo...
    • 4:03 - Presenting Existing Credentials

      // Requesting both Sign in with Apple and password-based accounts.
      
      import AuthenticationServices
      
      let controller = ASAuthorizationController(authorizationRequests: [
          ASAuthorizationAppleIDProvider().createRequest(),
          ASAuthorizationPasswordProvider().createRequest()
      ])
      
      controller.delegate = self
      controller.presentationContextProvider = self
      
      if #available(iOS 16.0, *) {
          controller.performRequests(options: .preferImmediatelyAvailableCredentials)
      } else {
          controller.performRequests()
      }
    • 5:14 - ASAuthorizationControllerDelegate Implementation

      // ASAuthorizationControllerDelegate
      
      func authorizationController(controller: ASAuthorizationController,
                                   didCompleteWithAuthorization authorization: ASAuthorization) {
          switch authorization.credential {  
      		case let appleIDCredential as ASAuthorizationAppleIDCredential:
              // Sign the user in with Apple ID credential.
              // ...
      
          case let passwordCredential as ASPasswordCredential:
             // Sign the user in with password credential
             // ...
         }
      }
      
      func authorizationController(controller: ASAuthorizationController, 
         didCompleteWithError error: Error) {
          // No credential found. Fall back to login UI.
      }
    • 12:00 - Checking Credential State

      // Check User Credentials on app launch
      
      let appleIDProvider = ASAuthorizationAppleIDProvider()
      appleIDProvider.getCredentialState(forUserID: "currentUserIdentifier") 
      { (credentialState, error) in
          switch(credentialState){
          case .authorized:
              // Found valid Apple ID credential
          case .revoked:
              // Apple ID credential revoked. Log the user out.
          case .notFound:
              // No credential found. Show login UI.
          case .transferred:
              // Team is transferred
          }
      }
    • 12:18 - Register for Revocation Notification

      // Register for revocation notification
      
      let notificationName = ASAuthorizationAppleIDProvider.credentialRevokedNotification
      
      NotificationCenter.default.addObserver(self, 
                                             selector: #selector(signOut(_:)),
                                             name: notificationName, 
                                             object: nil)
    • 17:55 - Sample HTML and Javascript Implementation

      // Embed Sign in with Apple JS
      <html>
          <body>
              <script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
              <div id="appleid-signin" data-color="white" data-border="true" data-type="sign in"/>
              <script type="text/javascript">
                  AppleID.auth.init({
                      clientId : '[CLIENT_ID]',
                      scope : '[SCOPES]',
                      redirectURI : '[REDIRECT_URI]',
                      state : '[STATE]',
                      nonce : '[NONCE]',
                      usePopup : true
                  });
              </script>
          </body>
      </html>
    • 18:28 - White Sign in with Apple Button

      <div id="appleid-signin" data-color="white" data-border="true" data-type="sign in"/>
    • 18:38 - Black Sign in with Apple Button

      <div id="appleid-signin" data-color="black" data-border="true" data-type="sign in"/>
    • 18:44 - Black Continue with Apple Button

      <div id="appleid-signin" data-color="black" data-border="true" data-type="continue"/>
    • 18:50 - Black Logo Only Button

      <div id="appleid-signin" data-color="black" data-border="true" data-mode="logo-only"/>
    • 19:47 - Sample HTML and Javascript Implementation

      // Embed Sign in with Apple JS
      <html>
          <body>
              <script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
              <div id="appleid-signin" data-color="white" data-border="true" data-type="sign in"/>
              <script type="text/javascript">
                  AppleID.auth.init({
                      clientId : '[CLIENT_ID]',
                      scope : '[SCOPES]',
                      redirectURI : '[REDIRECT_URI]',
                      state : '[STATE]',
                      nonce : '[NONCE]',
                      usePopup : true
                  });
              </script>
          </body>
      </html>
    • 21:11 - Handle DOM Response

      // Listen for authorization success.
      document.addEventListener('AppleIDSignInOnSuccess', (event) => {
          // Handle successful response.
          console.log(event.detail.data);
      });
      
      // Listen for authorization failures.
      document.addEventListener('AppleIDSignInOnFailure', (event) => {
           // Handle error.
           console.log(event.detail.error);
      });

Developer Footer

  • Vídeos
  • WWDC22
  • Enhance your Sign in with Apple experience
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines