So im facing a weird issue while making a request to my api. It works fine using something like postman. I get my response no issue but if I make a request from my frontend(on a seperate domain) the connection gets closed for some reason.
Here is my code
I make ajax request using axios
axios.get(mydomain/api/oauth)
.then(response => {
console.log(response)
}).catch(error => {
console.log(error.response.data)
})
which hits my backend method that should return a response like so
def oauth(request):
auth_client = AuthClient(
settings.CLIENT_ID,
settings.CLIENT_SECRET,
settings.REDIRECT_URI,
settings.ENVIRONMENT
)
url = auth_client.get_authorization_url([Scopes.ACCOUNTING])
request.session['state'] = auth_client.state_token
return HttpResponse(url)
But at this point I get this alarm
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
And like I said if I make this same request through postman I get my response. So I don't know what I am missing. I have applied cors thinking maybe its because my frontend is on seperate domain from backend but no luck. Plus the alarm is kind of vague... anybody face similar issue?