 
                     wxUrlOptions[.universalLinksOnly] = true
                 } else {
-                    urlComponents = URLComponents(string: "weixin://app/\(appID)/auth/")
-                    urlComponents?.queryItems = [
-                        URLQueryItem(name: "scope", value: scope),
-                        URLQueryItem(name: "state", value: "Weixinauth"),
-                    ]
-                }
-
-                guard let url = urlComponents?.url else {
-                    completionHandler(.failure(.sdk(.urlEncodeFailed)))
-                    return
-                }
-
-                shared.openURL(url, options: wxUrlOptions) { flag in
-                    if flag { return }
-                    completionHandler(.failure(.sdk(.invalidURLScheme)))
-                }
+                    urlComponents = schemeURLComponents()
+                }
+                
+                handleWeChatAuth(
+                    urlComponents,
+                    schemeURLComponents(),
+                    wxUrlOptions,
+                    completionHandler: completionHandler)
             }
         case .qq(let appID, _):
             let scope = scope ?? ""

            } else {
                var urlComponents: URLComponents?
                var wxUrlOptions = [UIApplication.OpenExternalURLOptionsKey : Any]()

                if let universalLink = universalLink,
                   let authUrl = shared.wechatUniversalLink(of: "auth") {

            shared.twitterAuthenticate(appID: appID, appKey: appKey, redirectURL: redirectURL)
        }
    }
    
    private class func handleWeChatAuth(
        _ urlComponents: URLComponents?,
        _ default: URLComponents?,
        _ wxUrlOptions: [UIApplication.OpenExternalURLOptionsKey : Any],
        completionHandler: @escaping OAuthCompletionHandler) {
        guard let url = urlComponents?.url else {
            completionHandler(.failure(.sdk(.urlEncodeFailed)))
            return
        }
        shared.openURL(url, options: wxUrlOptions) { flag in
            if flag { return }
            if wxUrlOptions.isEmpty {
                completionHandler(.failure(.sdk(.invalidURLScheme)))
                return
            }
            handleWeChatAuth(`default`, nil, [:], completionHandler: completionHandler)
        }
    }

    private class func fallbackToScheme(url: URL, completionHandler: @escaping OAuthCompletionHandler) {
        shared.openURL(url) { succeed in
