Django-oauth 在 ionic 应用程序中发送和接收数据时没有访问令牌吗?

Django-oauth is sending and receiving data without access token in ionic app?

我在 ionic android 应用程序中使用 Django-oauth-toolkit 进行社交身份验证。

首先,我从社交身份验证插件获取令牌,然后将其发送到 Django。 Django-oauth-toolkit 生成用户并向我发送访问令牌和刷新令牌。之后,当我发送 GET request for 用户相关数据时(没有在 header 中发送访问令牌),然后 django-oauth 也在接受请求并将用户数据发回给我。

怎么可能?我做错了什么吗?

找到原因了。

它的发生是由于

DEFAULT_AUTHENTICATION_CLASS
  'rest_framework.authentication.SessionAuthentication',

在 Django Rest 框架中。

这 class 允许所有没有访问令牌的 API。