Skip to content

Commit

Permalink
feat: cookie set in debug for AuthenticatedWebView
Browse files Browse the repository at this point in the history
  • Loading branch information
pmusolino committed Sep 2, 2021
1 parent ebcf1ee commit 49556c6
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,22 @@ struct AuthenticatedWebView: UIViewRepresentable {
return URLRequest(url: url)
}

#if DEBUG
let httpCookie = HTTPCookie(properties: [HTTPCookiePropertyKey.name: "store_sandbox",
HTTPCookiePropertyKey.value: "[secret",
HTTPCookiePropertyKey.domain: ".wordpress.com",
HTTPCookiePropertyKey.path: "/"])
if let cookie = httpCookie {
HTTPCookieStorage.shared.setCookies([cookie], for: WooConstants.URLs.loginWPCom.asURL(), mainDocumentURL: nil)
}
#endif
var request = URLRequest(url: WooConstants.URLs.loginWPCom.asURL())
request.httpMethod = "POST"
request.httpShouldHandleCookies = true
// let cookie = String(format: "store_sandbox=@;domain=.wordpress.com;path=/", "[secret]")
// request.setValue(cookie, forHTTPHeaderField: "Cookie")


let parameters = ["log": username,
"redirect_to": url.absoluteString,
"authorization": "Bearer " + token]
Expand Down

0 comments on commit 49556c6

Please sign in to comment.