Currently, my website is being hosted on GitHub pages and I am working on a simple web app that requires an API call. The API call consists of a web URL with specific parameters, including a personal API key issued by the service. It's important not to share this API key as it is like sharing your password. The service only provides account-specific API keys, not public ones.
Within my JavaScript file, there is a line that looks similar to this:
var api= "https://osu.ppy.sh/api/get_beatmaps?k=[MY API KEY HERE]"
This string is used in a getJSON call.
I realized that anyone can simply go to myname.github.io/js/script.js
and view the JavaScript code, exposing my API key. Is there a way to prevent access to this file or hide my API key from prying eyes?