パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v2.0.6

webview_cookie_manager

クッキー管理の問題に陥りましたか?このパッケージがお手伝いできます。あなたが探していたすべてのクッキー管理機能が含まれています。

AndroidiOS
30日間ダウンロード
4300
いいね数
85
Pub ポイント
150

パッケージをインストール

flutter pub add webview_cookie_manager

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

webview_cookie_manager パッケージは、Android および iOS の WebView を使用する Flutter アプリ向けに包括的なクッキー管理を提供します。WebView でレンダリングされたウェブコンテンツに関連するクッキーを読み取り、書き込み、削除、管理できるようにし、シームレスなセッション処理と認証を実現します。このパッケージは、プラットフォーム固有の WebView 実装と直接連携するように設計されており、プラットフォーム間で一貫した API を提供します。恒久的なログイン状態やウェブベースのサービスとの統合が必要なアプリに最適です。

用途

  • WebViewでの認証セッションの管理
  • アプリの再起動後にユーザーのログイン状態を維持する
  • WebView とバックエンドサービス間でのクッキーの同期
  • OAuth などのサードパーティログインフローの処理
  • 保存されたクッキーを使用したフォーム送信の自動化

主な機能

  • Android および iOS 用のクロスプラットフォームクッキー管理
  • WebViewでのクッキーの読み取りおよび書き込みのサポート
  • プラットフォームのWebViewコンポーネントとの統合
  • 一般的なクッキー操作のためのシンプルな API
  • クッキー データの安全な保存

適している対象

  • 埋め込みWebコンテンツを持つアプリ
  • 認証集約型アプリケーション
  • Webサービス統合
  • シングルサインオン (SSO) ワークフロー
  • Webベースのバックエンドを使用するモバイルアプリ

注意事項

  • WebView アクセスに適切な権限が必要です
  • WebView固有のクッキー コンテキストに限定
  • 複雑なシナリオには追加のセットアップが必要になる場合があります
  • 一般的なアプリ全体のクッキー管理には適していません
  • 下位プラットフォームのWebView実装に依存する

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Webview Cookie Manager

pub package

A flutter library to manager your web cookies for Android (API level 9+) and iOS (11+).

The cookies stores and retrieves using the httpCookieStore for iOS and CookieManager for Android.

Get started iOS

Set minimum version for iOS to 11.0

Usage

The WebCookieManager can be used directly or together with webview_flutter.

Get cookies
final cookieManager = WebviewCookieManager();

final gotCookies = await cookieManager.getCookies('https://youtube.com');
for (var item in gotCookies) {
  print(item);
}
Set a cookie
await cookieManager.setCookies([
              Cookie('cookieName', 'cookieValue')
                ..domain = 'youtube.com'
                ..expires = DateTime.now().add(Duration(days: 10))
                ..httpOnly = false
            ]);
Check is any cookie available
await cookieManager.hasCookies();
Remove a cookie
await cookieManager.removeCookie();
Clear cookies
await cookieManager.clearCookies();
Domain attribute

Domain attribute is not required according to RFC, but it is important to remember that empty domain causes undefined behavior. So it is highly reccommended to specify it this this way:

final cookie = Cookie('cookieName', 'cookieValue')..domain = 'youtube.com';
Secure attribute

If you see the error Strict Secure Cookie policy does not allow setting a secure cookie for http://your-domain.net/ for apps targeting >= R. Please either use the 'https:' scheme for this URL or omit the 'Secure' directive in the cookie value. Then you need to set the origin while setting the cookie, in that case setting the domain is not required.

final cookies = <Cookie>[];
// Add your cookie with secure flag to the array
cookieManager.setCookies(cookies, origin: 'https://your-domain.net')

Troubleshooting on iOS

  1. Set minimum target iOS version to 11 (see also #17)
  2. If you are using Objective C, check that PodFile have a flag use_frameworks (see also #4)
target 'Runner' do
  use_frameworks!
  use_modular_headers!
  ..........
end

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト