Hi all - I’m reading a guide called Login Script Templates for user onboarding, but the code samples for ASP dot NET appear to be in JavaScript. Does anyone know of a code sample in C# for onboarding users in the same way? Sorry I can’t share the article I’m reading on auth0’s very own documentation site, but I’m prevented from sharing links in this post.
Hi @cmuentes and thank you for the question!
The reason you’re seeing JavaScript code samples is that the custom database scripts themselves must be written in JavaScript.
These scripts (for logging in, creating a user, etc.) run in a secure, isolated Node.js environment on Auth0’s servers. Their job is to connect to your database and validate user credentials. Your C# application doesn’t execute this script directly; instead, it redirects the user to Auth0, and Auth0 executes the appropriate JavaScript script.
You will add your script in your Dashboard by going into Authentication - Database - Custom Database tab - Database Action Scripts section.
I hope this answers your question!
Teodor.
Yes that answers my question completely, thanks tremendously! Is it the case that the script can call any external service for authentication? Part of the problem we have is we’re trying to upgrade a legacy dot NET 4.x app to modern dotnet core, and the previous app rolled its own authentication including password hashing which uses legacy dotnet code to create password hashes. If I try to authenticate users with modern dotnet code, the passwords will never match unless I match the old hashing scheme. So my thinking is maybe this NodeJS script can call a C# service that will have this legacy hashing and return authentication result. Is that possible?
Yes, that should be possible. I can’t find an example, but I think you can just call your service and then pass the user to the callback function.
callback(null, response.user);
let me know if that doesn’t work and I’ll dig deeper for some more information.
kind regards,
Teodor.