JWT authentication does not work in Django Rest Framework after deploying it to IIS on live server
I built a Rest API using Django's Rest framework. And I've deployed it on Windows OS's IIS. When I deploy the application to the live IIS server, it throws the following issue even though it functions well on the local IIS server.
Note: I have passed the Authorization header correctly.
{
"errors": {
"detail": "Authentication credentials were not provided."
}
}
Maybe the error was in settings.py
file because I haven't updated the CORS_ALLOWED_ORIGINS
so I changed it as below:
Here's the snippet of code on my local machine
CORS_ALLOWED_ORIGINS = [
"http://localhost:8000",
"http://127.0.0.1:8000",
]
Here's the snippet of code on my live server,
CORS_ALLOWED_ORIGINS = [
"https://www.example.com"
]