用django rest框架服务器实现mosquitto jwt认证

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

我使用django rest framework jwt作为服务器实现了mosquitto jwt认证。 在配置中,我看到没有错误,但当我运行mosquitto和django我有一些错误,

在django终端,

"POST /api-token-auth/ HTTP/1.1" 400 79

在mosquitto.conf终端中,

1490583684: mosquitto version 1.4.11 (build date 2017-03-08 15:27:51+0700)  starting
1490583684: Config loaded from /etc/mosquitto/mosquitto.conf.
1490583684: |-- *** auth-plug: startup
1490583684: |-- ** Configured order: jwt

1490583684: |-- with_tls=false
1490583684: |-- getuser_uri=/api-token-auth/
1490583684: |-- superuser_uri=/superuser
1490583684: |-- aclcheck_uri=/acl
1490583684: |-- getuser_params=(null)
1490583684: |-- superuser_params=(null)
1490583684: |-- aclcheck_paramsi=(null)
1490583684: Opening ipv4 listen socket on port 1883.
1490583684: Opening ipv6 listen socket on port 1883.
1490583749: New connection from 127.0.0.1 on port 1883.
1490583749: |-- mosquitto_auth_unpwd_check(andri)
1490583749: |-- ** checking backend jwt
1490583749: |-- url=http://127.0.0.1:8000/api-token-auth/
1490583749: |-- data=topic=&acc=-1&clientid=
1490583749: |-- getuser(andri) AUTHENTICATED=0 by none
1490583749: Socket error on client <unknown>, disconnecting.

在这里我的mosquitto.conf

auth_plugin /etc/mosquitto/auth-plug.so
auth_opt_backends jwt
auth_opt_http_ip 127.0.0.1
auth_opt_http_port 8000
#auth_opt_http_hostname example.org
auth_opt_http_getuser_uri /api-token-auth/
auth_opt_http_superuser_uri /superuser
auth_opt_http_aclcheck_uri /acl

任何人都可以帮我解决我的错误吗?

python django rest authentication mosquitto
© www.soinside.com 2019 - 2024. All rights reserved.