怎么使用webview_flutter包读取httponly cookies,或者拦截所有响应?

huangapple go评论89阅读模式
英文:

How do i read httponly cookies with webview_flutter package, or intercept all the response with it?

问题

我正在使用webview_flutter包开发一个Flutter应用,遇到了一些与Cookie相关的问题。我想要获取HttpOnly Cookie,并在我的Flutter应用中处理该Cookie。但由于该Cookie是HttpOnly的,我无法获取它。那么,如何通过我的WebView获取该Cookie?或者是否可以监听当前URL头部的内容?

英文:

i'm developing a flutter app with webview_flutter package and have several problem with the cookies. I want to get httponly cookie with it, then proces the cookie inside my flutter app. But, because the cookie is http only, i can't get that. So, how to get the cookie via my webview? or can i listen what is in the header of my current url?

答案1

得分: 0

没办法通过evaluate JavaScript读取HTTP Only cookie,唯一的方法是手动调用API(比如登录),然后将cookie保存在全局状态或本地存储中。

问题解决。

英文:

There's no way to read HTTP Only cookie from evaluate JavaScript, the only way to read the cookie is manually hit the API(ex: login) then save the cookie inside a global state or save it locally to your local storage.

Case solved.

huangapple
  • 本文由 发表于 2023年3月8日 16:03:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/75670563.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定