Reputation: 83
How to hide my Unsplash api key in Laravel
I am making a call from a Vue component but my "Authorization id" api key is visible for everyone as you can see.
How can I hide the API key in Laravel? I am using Laravel 9.
I want to hide the "headers or just the "Authorization".
Hope someone can guide me :))
Unsplash.vue file:
const myAsync = async function fetchUnsplash() {
const response = await fetch('https://api.unsplash.com', {
headers: {
Authorization: 'Client-ID 1234',
},
});
};
Upvotes: 0
Views: 264
Reputation: 73
I don't know anything about the API that you are using, nor about Laravel, but I assume, you have a fixed string, that you have to send in the HTTP requests.
Because you mentioned you are using Laravel, you have both frontend and backend code.
So in my opinion
v1/entries
https://api.unsplash.com
API, with the secret Client ID.http(s)://<api-baseurl>/v1/entries
).Upvotes: 1