首页 > 解决方案 > Error 401 when trying to register a new user. Works fine on localhost (Django rest api)

问题描述

I have built a rest API using Django. I have tested the endpoints and everything seems to be working fine on localhost.However after deploying to digital ocean and trying to access the endpoint to register a new user. I get Error 401. What could be the problem?

标签: pythondjangodjango-rest-framework

解决方案


可能是一个长镜头,但如果我在调用 URL 而不是 HTTPS 时使用 HTTP 和/或忘记在末尾使用斜杠调用路由,我也会遇到类似的问题。最终会发生的是请求会出于某种原因丢弃令牌数据。


推荐阅读