Disable Context Object in Custom Database Scripts

Overview

This article explains how to disable the context object in Auth0 database scripts. This is particularly relevant for users who have accidentally enabled the context object and are looking for ways to revert this change.

Applies To

  • Auth0 Database Scripts
  • Auth0 Custom Scripts
  • Auth0 Context Object

Cause

Enabling the context object in database scripts is an irreversible operation. Once enabled, the context object will be passed to the script functions that have been updated to include it.

Solution

Once the context object is enabled in database scripts, this action cannot be undone. This is a design decision to ensure the scripts’ integrity and consistency.

Avoiding the Context Object:

  • The context object is only passed to script functions that have the expected number of parameters. If the function signature is not updated to include the context parameter, the context object will not be passed to the script.

Function Signature:

  • Original function signature without context:

    function login(email, password, callback) {
    // Your logic here
    }
    
  • Updated function signature with context:

    function login(email, password, context, callback) {
    // Your logic here
    }
    

Steps to Ensure Context is Not Used:

  • Do not update the function signatures to include the context parameter if the context object should not be used in the scripts.

By following these guidelines, it is ensured that the context object is not utilized in the database scripts, effectively disabling its impact.