Created
August 3, 2016 18:36
-
-
Save colllin/22bc2bb79a842116e18c73b0e6a2368f to your computer and use it in GitHub Desktop.
Auth0 `Login` database action script NO-OP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function login (email, password, callback) { | |
// This script should authenticate a user against the credentials stored in | |
// your database. | |
// It is executed when a user attempts to log in or immediately after signing | |
// up (as a verification that the user was successfully signed up). | |
// The `password` parameter of this function is in plain text. It must be | |
// hashed/salted to match whatever is stored in your database. For example: | |
// if (bcrypt.compareSync(password, dbPasswordHash)) { ... } | |
// | |
// There are three ways this script can finish: | |
// 1. The user's credentials are valid. The returned user profile should be in | |
// the following format: https://auth0.com/docs/user-profile | |
// callback(null, profile); | |
// 2. The user's credentials are invalid | |
// callback(new WrongUsernameOrPasswordError(email, "my error message")); | |
// 3. Something went wrong while trying to reach your database | |
// callback(new Error("my error message")); | |
var msg = "Please implement the Login script for this database connection " | |
+ "at https://manage.auth0.com/#/connections/database"; | |
return callback(new WrongUsernameOrPasswordError(msg)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment