From 154fc7cd020999d246f1881d61a53a14f6f85b4e Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 23 Jun 2020 19:32:30 -0400 Subject: [PATCH] Fix ASWebAuthenticationSession usage in Catalyst --- Tusker/Screens/Onboarding/OnboardingViewController.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Tusker/Screens/Onboarding/OnboardingViewController.swift b/Tusker/Screens/Onboarding/OnboardingViewController.swift index fe13b67d..9b7750f8 100644 --- a/Tusker/Screens/Onboarding/OnboardingViewController.swift +++ b/Tusker/Screens/Onboarding/OnboardingViewController.swift @@ -48,19 +48,17 @@ extension OnboardingViewController: InstanceSelectorTableViewControllerDelegate let mastodonController = MastodonController(instanceURL: instanceURL) mastodonController.registerApp { (clientID, clientSecret) in - let callbackURL = "tusker://oauth" - var components = URLComponents(url: instanceURL, resolvingAgainstBaseURL: false)! components.path = "/oauth/authorize" components.queryItems = [ URLQueryItem(name: "client_id", value: clientID), URLQueryItem(name: "response_type", value: "code"), URLQueryItem(name: "scope", value: "read write follow"), - URLQueryItem(name: "redirect_uri", value: callbackURL) + URLQueryItem(name: "redirect_uri", value: "tusker://oauth") ] let authorizeURL = components.url! - self.authenticationSession = ASWebAuthenticationSession(url: authorizeURL, callbackURLScheme: callbackURL) { url, error in + self.authenticationSession = ASWebAuthenticationSession(url: authorizeURL, callbackURLScheme: "tusker") { url, error in guard error == nil, let url = url, let components = URLComponents(url: url, resolvingAgainstBaseURL: true),