Last active
June 5, 2020 13:40
-
-
Save Yoloabdo/26733688274455cb2de28cf728b2d518 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @available(iOS 13.0, *) | |
| class AppleAuthService: NSObject, AuthService { | |
| private weak var viewController: UIViewController? | |
| private weak var delegate: AuthServiceDelegate? | |
| private var backendAuth: ServiceAuthorizer? | |
| var authType: PreferredAuthMethod = .apple | |
| init(_ viewController: UIViewController?, delegate: AuthServiceDelegate?) { | |
| self.viewController = viewController | |
| self.delegate = delegate | |
| self.backendAuth = BackendAuthorizer(delegate: delegate) | |
| } | |
| func authenticate() { | |
| let appleIDProvider = ASAuthorizationAppleIDProvider() | |
| let request = appleIDProvider.createRequest() | |
| request.requestedScopes = [.fullName, .email] | |
| let authorizationController = ASAuthorizationController(authorizationRequests: [request]) | |
| authorizationController.delegate = self | |
| authorizationController.presentationContextProvider = self | |
| authorizationController.performRequests() | |
| } | |
| func deAuthenticate() { | |
| // no sign out on apple method. | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment