-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
CookieManager #50
Comments
Did you try the CookieManager class already? |
I did but I am not sure how to use it, I have a loop where I get the cookie key/values and within the loop I have: |
Any update on this? I'm also getting this issue... |
Hello,I have ever occurred this problem for a long time , util now, I could not find any solution. |
@MattHamburger Try the latest version of the plugin. Also, this plugin changed its name to @VincentTung1 import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
Future main() async {
runApp(new MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: InAppWebViewPage()
);
}
}
class InAppWebViewPage extends StatefulWidget {
@override
_InAppWebViewPageState createState() => new _InAppWebViewPageState();
}
class _InAppWebViewPageState extends State<InAppWebViewPage> {
InAppWebViewController webView;
final CookieManager cookieManager = CookieManager.instance();
@override
void initState() {
super.initState();
var expiresDate = DateTime.parse("2019-09-30 00:00:00.000").millisecondsSinceEpoch;
cookieManager.setCookie(url: "https://flutter.dev", name: "myToken", value: "wertygubnm5046rhndf", domain: ".flutter.dev", expiresDate: expiresDate);
cookieManager.setCookie(url: "https://flutter.dev", name: "myCookie", value: "myValue", domain: ".flutter.dev", expiresDate: expiresDate);
cookieManager.setCookie(url: "https://flutter.dev", name: "myCookie2", value: "myValue2");
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("InAppWebView")
),
body: SafeArea(
child: Column(children: <Widget>[
Expanded(
child: Container(
child: InAppWebView(
initialUrl: "https://flutter.dev",
initialHeaders: {},
initialOptions: InAppWebViewWidgetOptions(
inAppWebViewOptions: InAppWebViewOptions(
debuggingEnabled: true,
)
),
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
},
onLoadStart: (InAppWebViewController controller, String url) {
},
onLoadStop: (InAppWebViewController controller, String url) async {
print(await controller.evaluateJavascript(source: "document.cookie"));
},
),
),
),
ButtonBar(
alignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
child: Icon(Icons.arrow_back),
onPressed: () {
if (webView != null) {
webView.goBack();
}
},
),
RaisedButton(
child: Icon(Icons.arrow_forward),
onPressed: () {
if (webView != null) {
webView.goForward();
}
},
),
RaisedButton(
child: Icon(Icons.refresh),
onPressed: () {
if (webView != null) {
webView.reload();
}
},
),
],
),
]))
);
}
} It prints all of my cookies:
|
But I have tried your code for testing again, unfortunately,it still no work.I simply want to set the cookie named "JSESSIONID"。Have you ever tried this key ? I really want to solve the problem, or can you give me your any contact way for me ? |
Does the cookieManager must set in the method "initState"? |
This issue is stale and has been automatically closed because it has been open for more than 365 days with no activity. Please reopen a new issue if you still have it. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue. |
In my app I am logging in to a server using HttpClient in http.dart. I get two cookies from the server and use them in all requests.
I need to use embedded web views in several places so I am trying to use the inappbrowser.
Is there a way to set the cookies?
The text was updated successfully, but these errors were encountered: