hello, I would like to protect some private information from firebase ( firebaseConfig ) for web, is there any feature in Jserver that helps to protect information like: apiKey, authDomain, databaseURL, projectId and the like?
using NodeJs , you can use environment variables (.env) to secure this information. is there any solution for b4j ?
if by client side you mean the browser then you can store cookies, the semi correct implementation is to encrypt those cookies with any encryption library and send it. The correct implementation is that the cookie is just a pointer to the real information on your server.
if you mean client side refering to jserver on your vps (completly incorrect), then the line i sent is the same as the one nodejs uses.
I have the firebase.js file that is loaded in the index.html page.
index.html:
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>TodoList</title>
<link rel="shortcut icon" href="img/todoListFavicon.png" type="image/x-icon">
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<div id="app">
<!--Logotipo do TodoList-->
<div class="center">
<img src="img/todoList.png">
</div>
<!--Feedback de carregamento (loading)-->
<div id="loading">
<img src="img/loading.gif" alt="Animação de carregamento">
</div>
<!--Conteúdo destinado para usuários não autenticados-->
<div id="auth" class="center">
<!--Formulário de autenticação-->
<form id="authForm">
<h3 id="authFormTitle">Acesse a sua conta para continuar</h3>
<label for="email">E-mail: </label>
<input type="email" placeholder="E-mail" id="email">
<label for="password">Senha: </label>
<input type="password" placeholder="Senha" id="password">
<button type="submit" id="submitAuthForm">Acessar</button>
</form>
<!--Alternar o fomulário de autenticação para o cadastro de novas contas-->
<p id="register">
Não possui uma conta?
<button onclick="toggleToRegister()" class="alternative">Cadastrar uma nova conta</button>
</p>
<!--Alternar o fomulário de autenticação para o acesso de contas já existentes-->
<p id="access" class="startHidden">
Já possui uma conta?
<button onclick="toggleToAccess()" class="alternative">Acesse a sua conta</button>
</p>
</div>
</div>
<!--Recursos do Firebase-->
<script src="https://www.gstatic.com/firebasejs/7.8.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.8.1/firebase-auth.js"></script>
<!-- LOADING FIREBASE.JS BELOW -->
<script src="js/firebase.js"></script>
<script src="js/utils.js"></script>
<script src="js/auth.js"></script>
</body>
</html>
firebase.js is where the "public" access settings for the firebase project .
but I would like to hide this information, even if it is "public", because in the documentation itself it is said that it is recommended to hide the information.
the information below is just an example of what I would like to hide.
You are using a client side library firebase.js - nothing to do with jserver.
The documentation doesn’t list an options to obscure or encrypt the details when initialising. If you were to do anything you would need to do it on the client side before you called the library - so kind of pointless since someone could just use developer tools to see the decrypted settings anyway.
Usually with API keys you would limit access to a specific url or up address. I don’t have experience with firebase but many apis have this feature. So even if someone had the api key they can’t use it.
The Firebase Web-App guide states I should put the given apiKey in my Html to initialize Firebase: // TODO: Replace with your project's customized code snippet <script src="https://www.gsta...