'Not allowed by CORS

I'm trying to automate a process so I want to connect to an external API, first just to log in (can't use the API Key since I'm not an admin user).

I basically copied the request the browser does when it logs in, but when doing this from Postman I get a 400 responde, with the body "Not allowed by CORS".

Is there any way through code, that I can bypass that and work with such API?

The postman request



Solution 1:[1]

Cors means Cross-Origin Resource Sharing. Basically browsers help web servers a way to protect themselves for data change requests.

Remove Origin Header (or) replace Origin value to server hostname (in this case api.kenjo.io)

Add referer header. With dothttp it would look like below.

POST 'https://api.kenjo.io/auth/token'
origin: 'https://www.kenjo.io'
referer: 'https://www.kenjo.io/'

Solution 2:[2]

What server are you using? Some servers are required additional configuration for such mime types.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Önder ALKAN