Check Dependency Versions Within Auth0 Database Scripts

Overview

Oftentimes, admins would like to confirm which dependency version they are using within custom database scripts. Unlike within Extensability (such as a postLogin Action), there is no visible way to check this within the Auth0 Dashboard.

Applies To
  • Custom Database
  • Custom Database Scripts
  • Dependency Version
  • Real Time Action Logs
  • Auth0
Solution

Because there is no current method of viewing these details, enable the Real Time Action Logs and add a console.log to output the dependency version as such:

function login(email, password, callback) {
  
  const bcrypt = require('bcrypt');
  const MongoClient = require('mongodb');
  const client = new MongoClient('...');
  const axios = require('axios');
  
  console.log("axios: " + axios.VERSION);
  
  
  client.connect(function (err) {
    if (err) return callback(err);

    const db = client.db('auth0');
    const users = db.collection('users');

    users.findOne({ email: email }, function (err, user) {
      if (err || !user) {
        client.close();
        return callback(err || new WrongUsernameOrPasswordError(email));
      }

      bcrypt.compare(password, user.password, function (err, isValid) {
        client.close();

        if (err || !isValid) return callback(err || new WrongUsernameOrPasswordError(email));

        return callback(null, {
            user_id: user._id.toString(),
            nickname: user.nickname,
            email: user.email
          });
      });
    });
  });
}

Recommended content

No recommended content found...