Solved Access the qml webview cookies from c++
-
Hi
I am using the simple webview qml and now I need to find a way to access the cookies as these will be needed to make api calls to a web portal.
I want to use webview as I want to use this app on android(webengine doesn't support android) as well as desktop.
Here is the code.
https://github.com/vipconsult/portalChatyou can git clone and build it.
the first tab is where I will login and the second tab is where I will make the api calls but need to use the cookies for the authentication to the api.
appreciate any suggestions.
-
-
yes that might be a some weird solution.
Do you know where the webview stores the cookies and if it is some standard format so I can maybe read and parse the file directly
-
@Krasi On Linux desktop systems
WebView
uses chrome. So the default location on it will be.local/share/ApplicationName/QtWebEngine/Default/Cookies
in user's home directory.
Also it wont be a flat file but a SQLite database. -
Thanks , I did some strace and figured the file location, but I don't think there is any uniform way to access the file regarding on which platform it is . I guess android and ios might not even use sqlite.
-
@Krasi said in Access the qml webview cookies from c++:
but I don't think there is any uniform way to access the file regarding on which platform it is...
According to me the best way if it is possible is to go through the JS method I described in first post.
I guess android and ios might not even use sqlite.
Atleast android does. The database is stored in the
data
folder of each application's sandboxed environment. -
Yes the JS method works fine. Thanks a lot for the suggestion.