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
Query(
Lambda(["data"], {
response: Login(
Match(Index("user_by_email"), Select("eMail", Var("data"))),
{ password: Select("password", Var("data")) }
)
})
)
const faunaClient = new faunadb.Client({
secret: 'FAUNA_GUEST_KEY',
})
return await faunaClient
.query(q.Call(q.Function('login_user'), { eMail, password }))
.then(({ response }) => {
console.log(response) // I get a secret
})
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?
gregor