Trigger for Custom Authentication not firing

My trigger are not firing for Custom Authentication.
i have tested with Anonymous and email password authentication, they worked.

I created a custom function to login in my app with Authentication: Application Authentication

const credentials = Realm.Credentials.function(payload);
const user = await app.logIn(credentials);

Then i created a trigger for Custom authentication, but when i make login through the login function, it not fires.

exports = function(data){
const mongodb = context.services.get(“mongodb-atlas”);
const users = mongodb.db(“app”).collection(“users”);
return users.insertOne({ user: “NOVO USUARIO TESTE” });
};

Thank you for help

Hi @Royal_Advice,

I can verify if auth triggers are expected to be fired for custom function provider.

According to the provider list I don’t see custom-function as one. However , it might be out dated

Please note that since your auth function have an insert or potentially login time update you can use a database trigger on that collection instead…

Best
Pavel

look this list

Captura de Tela 2020-10-19 às 06.28.32

Hi @Royal_Advice,

If you are looking into Custom Authentication its for custom JWT and not function.

Best
Pavel

1 Like

this is sad, thank you for your time

@Royal_Advice,

I think its a legitimate feature request you can file on https://feedback.mongodb.com

CC: @Drew_DiPalma

Thanks
Pavel

@Royal_Advice – We’re aware that there is a gap in Auth Triggers and are hoping to add this functionality soon.

thank you all, im will try a workaround

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.