ashishkumar2804 edited a comment on issue #753:
URL:
https://github.com/apache/cordova-plugin-inappbrowser/issues/753#issuecomment-725394180
@sandrolombardo : when you do authentication using Jquery-Ajax calls,
cookie will be stored in **NSHTTPCookieStorage** namespace. you will need to
manually save it in **WKHTTPCookieStore** this is the store, from where
WKwebview(In-app browser) will take cookies and sent it along the request. You
can use below sample code to do so.
`NSString *domain = (NSString*) [cdvCommand.arguments objectAtIndex:0];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSHTTPCookie *cookie;
NSArray *cookieArray = (NSArray*)[defaults objectForKey:[NSString
stringWithFormat:@"cdvCookieJar:@%@", domain]];
for (NSDictionary *cookieProps in cookieArray) {
cookie = [[NSHTTPCookie alloc] initWithProperties:cookieProps];
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];
}
WKWebView* wkWebView = (WKWebView*) self.webView;
WKHTTPCookieStore* cookieStore =
wkWebView.configuration.websiteDataStore.httpCookieStore;
NSArray *httpCookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage]
cookies];
for (NSHTTPCookie *cookie in httpCookies) {
[cookieStore setCookie:cookie completionHandler:nil];
}`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]