缺少HTTPS标头为推ChatKit阿比

问题描述 投票:0回答:1

我试图让ChatKit到FlutterSDK,但我面对的一点微小的问题,,我送请求ChatKit终点,,但是我觉得我失去了头,所以我从来没有得到authed ,,(代码效应初探401)

所以我应该为标题使用?

我试图通过飞镖的Http包连接

   static String _apiEndPoint =
     "https://us1.pusherplatform.io/services/chatkit/v2/:instance_id";
   static final String _usersEndPoint = "/users";

   var uri = Uri.parse("$_apiEndPoint$_usersEndPoint");
   var request = new http.MultipartRequest("POST", uri);
   request.fields['name'] = '$name';
   request.fields['id'] = '$username';
   request.fields['avatar_url'] = '$avatarUrl';
   request.fields['custom_data'] = '{"email": "$email"}';
   request.send().then((response) {
     print(response.statusCode);
   });

我想这就够了按照这里的文档创建用户帐户:https://docs.pusher.com/chatkit/reference/api#create-a-user

dart flutter pusher chatkit
1个回答
1
投票

您需要添加一个头(使用request.headers['authorization'] = 'Bearer $token';),并计算承载令牌描述here

© www.soinside.com 2019 - 2024. All rights reserved.