6

我想制作一个新的颤振应用程序,我正在使用 Facebook 登录 SDK(用于颤振)。登录已成功实现,我能够获取连接用户的访问令牌和 UID。

我的问题是,当用户登录时,我想保留这些 cookie 以将其与 HTTP 请求一起使用。我能够使用本机 android(使用cookiejarandOKHTTP库)进行制作。我想知道 Flutter 是否仍然有可能。

4

1 回答 1

-2

查看requests,一个 Flutter 库,可帮助处理现代 RESTful http 请求(基本 cookie 支持和 json)

发布规范.yaml

dependencies:
  requests: ^1.0.0

用法:

import 'package:requests/requests.dart';

// ...

// this will persist cookies
await Requests.post("https://example.com/api/v1/login", body: {"username":"...", "password":"..."} ); 

// this will re-use the persisted cookies
dynamic data = await Requests.get("https://example.com/api/v1/stuff", json: true); 
于 2019-02-01T05:48:41.117 回答