我正在尝试将 ChatKit 安装到 FlutterSDK,但我遇到了一个小问题,我正在向 ChatKit End Point 发送请求,但我认为我缺少标题,所以我永远不会获得身份验证,,(响应代码401)
那么我应该使用什么作为标题?
我试图通过 Dart 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