0

我将django用于后端,并将颤振用于项目的前端应用程序。使用基于 knox 的 url登录和注册用户可以正常工作,但是在 Flutter 应用程序中注销时会出现问题。我使用knox LogoutView注销用户。我已经搜索了很多解决方案,但未能获得任何可靠的线索。下面是注销实现

Future<void> logout() async {
    Response response = await post("http://10.0.2.2:8000/api/auth/logout",
    headers: <String,String>{
        "Content-Type": "application/json; charset=UTF-8",
        "Authorization":  "token $_token"
});

}

我使用 SharedPreferences 来存储令牌。我在终端中收到以下错误。

Unauthorized: /api/auth/logout
[20/Apr/2021 12:40:14] "POST /api/auth/logout HTTP/1.1" 401 27

任何帮助表示赞赏!

4

0 回答 0