Skip to content

Commit

Permalink
+1
Browse files Browse the repository at this point in the history
  • Loading branch information
borut-t committed Sep 21, 2023
1 parent 2ab692d commit 695f79d
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions Sources/LinkedIn/WebView/LinkedInWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,19 @@ public extension LinkedInWebView {
}

print("URL", webView.url?.absoluteString)
guard let url = webView.url /*, url.host == parent.configuration.redirectUrl.host*/ else {
guard let url = webView.url, url.host == parent.configuration.redirectUrl.host else {
decisionHandler(.allow)
return
}

// extract the authorization code
let components = URLComponents(string: url.absoluteString)
guard let state = components?.queryItems?.first(where: { $0.name == "state" }),
guard let state = components?.queryItems?.first(where: { $0.name == "state" })?.value,
requestState == state,
let code = components?.queryItems?.first(where: { $0.name == "code" }) else {
decisionHandler(.allow)
return
}
// guard requestState == state.value ?? "" else {
// parent.onFailure?()
// decisionHandler(.allow)
// parent.dismiss()
// return
// }
parent.onSuccess?((code.value ?? "", parent.requestState))
decisionHandler(.cancel)
parent.dismiss()
Expand Down

0 comments on commit 695f79d

Please sign in to comment.