Hi, I’m new to faunadb and started with some simple tutorials. But now I got stuck… I achieved to create a collection with users and authenticate them. I did this with a GUEST key and a GUEST role, that have only rights for the loginFn
After authentication the user should get more rights, like creating an item in a collection.
I created for that another role “loggedIn”: Then I created a new key “FAUNA_LOOGEDIN_KEY” with the role “loogedIn”. But how can I change the current secret “FAUNA_GUEST_KEY” with the “FAUNA_LOOGEDIN_KEY”? Or is the secret from the response my new key and I don’t need to create a separate “FAUNA_LOOGEDIN_KEY”? But the question is the same how can I update the secret?
And if I need to use the secret from the response how can I link it to the role “loggedIn” or where I have to define an UDF that the role can get applied to that secret?
Where I don’t get my head around is the role thing. How does fauna know that it should apply this role with privileges only to authenticated users and not all users?
Update
I got everything running.
But my question is still, does fauna check the identity for me automatically, if the user, who is bound to the new secret, exists in the collection “users” and if yes the new role gets applied?
And one more question when the new role is applied, do I have to set all privileges again from “public” for “loggedIn”? Because the initial key, which was bound to the role “public”, has been replaced by the new secret(key)?