首页 > 解决方案 > Strange Error with Django oauth-toolkit and Azure App Service. Returns 401 {"detail":"Error decoding token."} when attempting to authenticate token

问题描述

Hi I am deploying an app to Azure App Service using Django Rest Framework with OAuth2 authentication handled by django-oauth-toolkit (https://github.com/jazzband/django-oauth-toolkit). Recently when trying to connect to my React frontend I have found out that I cannot successfully authorize despite having an access token. When I make a the following API call (as suggested by the documentation):

curl 'http://exampleurl.azurewebsites.net/endpoint/' -H 'authorization:Bearer <sampletoken>'

I get the following response:

{"detail":"Error decoding token."}

I cannot recreate this error locally nor can I find any information about this error anywhere online. I even searched the repository for the error to see if I could find what triggers it, unfortunately no luck.

Has anyone else ever experience this or can give me some insight on what potentially occurred in my deployment to cause this? I also deleted out my old deployment and even app service to completely start from scratch and the problem persisted.

标签: pythondjangoazuredjango-rest-frameworkdjango-oauth-toolkit

解决方案


推荐阅读