Why get 403 forbidden when get API data?

how to resolve 403 forbidden error in postman
post 403 (forbidden)
http/1.1 403 forbidden
failed to load resource: the server responded with a status of 403 (forbidden)
403 forbidden error in ajax post call
403 forbidden web api
web api return 403 forbidden
xmlhttprequest 403 forbidden

Using react-admin at front-end to access gin developed API back-end.

When access url from chrome browser:


Got this message from chrome Console:

fetch.js:41 OPTIONS http://localhost:8080/posts?_end=10&_order=DESC&_sort=id&_start=0 403 (Forbidden)

But if access the uri above from browser, it can return json result.

From the gin developed API output, got this message:

[GIN] 2018/06/13 - 16:38:16 | 403 |       1.995µs |             ::1 | OPTIONS  /posts?_end=10&_order=DESC&_sort=id&_start=0

Since the frontend and the backend are at different origins (localhost:3000 and localhost:8080 respectively), you'll need to set up CORS on the backend side to allow localhost:3000 to access it.

https://github.com/gin-contrib/cors looks like the ticket for that.

Why get 403 forbidden when get API data?, Since the frontend and the backend are at different origins (localhost:3000 and localhost:8080 respectively), you'll need to set up CORS on the  For more information, see Set Up a Custom Domain Name for an API in API Gateway. Connect to public APIs with private DNS disabled. If private DNS is disabled for an interface VPC endpoint for API Gateway, or if you don't have an interface endpoint in the Amazon VPC, confirm that any: Security groups for your VPC allow outbound traffic to your

Setting the access control allow origin header for the response in your server side application will fix the issue.


'Access-Control-Allow-Origin: http://localhost:3000' or

'Access-Control-Allow-Origin: *' 

in your serrver side code.

Solved: 403 Forbidden on POST method of /rest/api/2/issue , Solved: Hello, I am using the /rest/api/2/issue API of JIRA. but i get 403 forbidden error on POST with basic authentication which i used in GET method. The POST method works POST request with {username, password} json data. * with or  To make this work you need to support the OPTIONS HTTP method call in addition to the GET you already support in your application, and return appropriate CORS headers in the response to allow the other origin to access the resources on that host.

You should add a CORSmiddleware


r := gin.Default()


func CORSMiddleware() gin.HandlerFunc {
    return func(c *gin.Context) {
        c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
        c.Writer.Header().Set("Access-Control-Max-Age", "86400")
        c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE")
        c.Writer.Header().Set("Access-Control-Allow-Headers", "Origin, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization")
        c.Writer.Header().Set("Access-Control-Expose-Headers", "Content-Length")
        c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
        if c.Request.Method == "OPTIONS" {
        } else {

Solved: 403 forbidden error when using POST method to acce, I can acces GET method easily and get the data using rest api, but cannot access PUT/POST method(got 403()). So have added the following code, AP.request({ forbidden (403) : Access forbidden :The request may not be properly authorized. quotaExceeded (403) : quotaExceeded : The request cannot be completed because you have exceeded your quota. You can try adding OAuth using this documentation on YouTube Data API Overview as a guide.

Why get 403 forbidden when get API data? : golang, Why get 403 forbidden when get API data? Using react-admin at front-end to access gin developed API back-end  Only the client is different, i fire the Curl command from Linux command line which works fine, but when try to hit the API using the AJAX jquery call (using the same authenticatio), i get 403 forbidden error

403 Forbidden Error: What It Is and How to Fix It, A detailed explanation of what a 403 Forbidden Error response is, including client does not have proper authorization to access to the requested content. As with database, and so forth, before attempting any fixes or changes to the system. Airbrake Docs · API Docs · Blog · Status Site · Email Support. The 403 error is caused by calling the Power BI get datasets API with an id_token where an acess token is required. Per the ADAL JS lib , to get the access token, you'll have to call ADAL.acquireToken function after login.

HTTP Error 403 Forbidden: What It Means and How to Fix It, If you encounter this it usually means that you have already authenticated yourself with the server, i.e. you've logged in, but the resource you have  Another reason for encountering a 403 Error Forbidden message is bad permissions for your files or folders. In general, when files are created, they come with certain default permissions. These basically control how you can read, write and execute the files for your use.