Search code examples
httprequestgitlab-api

Getting {"message":"404 Project Not Found"} response while making request through nonauthorized browser window


I am getting expected response while doing HTTP get a request through an authorized browser window, but I receiving 404 - project not found response while trying to do the same HTTP request from the private browser window or browser window that is authorized by another account. I am using Google Chrome Browser, I am receiving the same 404 response when I try to make a request using node.js npm gitlab package.

http://:mydomain/api/v4/projects/:projectID/repository/commits/dev/diff?authorization:Bearer%myAccessTocken&format=json&Content-Type:application/json

when I make this request in the authorized browser, I received diffs of the last commit made in dev branch, but when I make the same request in private window, I receive 404.

I guess I need to pass some additional headers or parameters to request. How can I fix this?


Solution

  • can't really give you an answer with that information, but i noticed that your query string should not be a query string but be the header. (authorization is not passed as an argument but as a header) also check your route if it can pass a query string