Public snippet cannot be accessed via API without authentication
Summary
A public snippet can be open in the browser directly without authentication. But when accessing with API, a 401 Unauthorized
error is returned.
Steps to reproduce
- Create a public snippet from https://gitlab.com/-/snippets/new.
- Open an incognito window and visit
https://gitlab.com/api/v4/snippets/<SNIPPET_ID>
.
Quick reproduction: just visit https://gitlab.com/api/v4/snippets/2013793 from a newly created incognito window (to make sure that you are not logged in).
Example Project
My public snippet: https://gitlab.com/-/snippets/2013793
What is the current bug behavior?
The API returns 401 Unauthorized
.
What is the expected correct behavior?
It should return the content of the snippet since it's public, as in GitHub.
Output of checks
This bug happens on GitLab.com