I want to add a basic authentication for access to this form using JavaScript.
As a user id I want to use the four character code from the 'door'-select field. A password field may be added to the form. Logged in users may do anything with the form (which is only view data and add by clicking on 'opslaan'). Anyone else may see the form but not any data and may also not add data.
I find in the firebase documentation that firebase simpleLogin should not be used (depreciated).
What is the simplest way to get this done in an way that is not considered depreciated? Do I need to setup custom authentication for this (see here) or is it easier to start off with email&password authentication and customize the code (I find this on Github) for my needs? Both routes seem very unsimple to me so please advise on what to do step by step?
Security rules would be something like this:
{
"rules": {
"users": {
"$user_id": {
".write": "$user_id === auth.uid.replace('simplelogin:', '')",
".read": true
}
},
"leerling": {
".read": "auth != null",
".write": "auth != null"
}
}
}
with /leerling being the node containing all the data that may be accessed through the form.
Aucun commentaire:
Enregistrer un commentaire