Интеграция LinkedIn Проблема OAuth-2.0 WebClient в iOS - PullRequest
0 голосов
/ 19 февраля 2019

Как очистить кеш и файлы cookie с веб-страницы LinkedinOAuthWebClient.Я впервые захожу в LinkIn через LinkedinOAuthWebClient, но программно linkedIn?.logout() выход из системы не работает.Ниже мой код:

Примечание: pod 'LinkedinSwift', '~> 1.7.9'

Здесь мой код: swift 3.0

@objc func linkedInButtonTaped() {
    let linkedIn = LinkedinOAuthWebClient.init(redirectURL: Constants.LINKED_IN_AUTH2, clientId: Constants.CLIENT_ID, clientSecret: Constants.CLIENT_SECRET, state: "linkedin\(Int(Date().timeIntervalSince1970))", permissions: ["r_basicprofile", "r_emailaddress"], present: self)
        linkedIn?.logout()
        linkedIn?.authorizeSuccess({ (token) in

            print("token", token)

            ShowLoading.default.show(message: "Fetching profile information, please wait...")

            linkedIn?.requestURL(self.urlPermissionLinkedIn, requestType: LinkedinSwiftRequestGet, token: token, success: { (response) in

                if let res = response.jsonObject, let jsonObj = try? JSONSerialization.data(withJSONObject: res, options: .prettyPrinted) {
                    print("response => " , NSString.init(data: jsonObj, encoding: String.Encoding.utf8.rawValue) ?? "")
                }
                self.commonLinkedIn(dataDictionary: response.jsonObject!)
                ShowLoading.default.hide()
                linkedIn?.logout()

            }, error: { (getError) in
                DispatchQueue.main.async {
                    ShowLoading.default.hide()
                    ShowToast.show(message: getError.localizedDescription)
                    linkedIn?.logout()

                }
            })

        }, error: { (getError) in
            DispatchQueue.main.async {
                ShowToast.show(message: getError.localizedDescription)
                linkedIn?.logout()
            }
        }, cancel: {
            DispatchQueue.main.async {
                ShowToast.show(message: "LikendIn login cancelled.")
                linkedIn?.logout()
            }
        })
}
...