DjemsD
DjemsD

Reputation: 76

is it safe to have 'firebase-messaging-sw.js" in public url

i have setup Firebase Cloud Messaging in the doc it's asked to put the firebase-messaging-sw.js file in the public folder. Knowing that the latter contains the firebase configuration object which contains the identification keys. AND which is public, "localhost: 3000/firebase-messaging-sw.js" shows all this config. how can i avoid this

Upvotes: 0

Views: 1692

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317312

All of the JavaScript to be executed in the browser in your web project is public. firebase-messaging-sw.js is no different. You can't protect it from view, because if you did somehow, it would no longer be runnable by the browser like all your other code.

If you're worried about your Firebase project API, that's a public piece of information is is not a security issue.

Upvotes: 1

Related Questions