I went through the Django API authorization tutorial, and everything works except when I have to use my token to assess my endpoint I receive a Unauthorized response. When I don’t use a token I get the expected response of needing a token.
How are you testing the token? Are you calling the API from an SPA, Machine-to-Machine application, etc? Can you share a bit more details about how you are getting the token and using it?
Hey @kimcodes, I followed the Quickstarts guide to Using your API, but I always get Unauthorized to my endpoint.
I ran the following curl commands after setting up a Machine-to-Machine app
curl --request POST
–header ‘content-type: application/x-www-form-urlencoded’
curl --request GET
–header ‘authorization: Bearer YOUR_ACCESS_TOKEN’
Figured out the issue. It had to do with the JWT_ISSUER param in settings.py. When I decoded the token at https://jwt.io. The issuer had the entire url vs the guide just had part of it. I updated to include the entire url and it worked perfectly.
Glad you have it working @amovsesy!
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.