Context object in Custom Database

Problem statement

We want to capture request attributes after signup from the universal login screen to our custom database connection. In particular, the query string params.

Troubleshooting

You can check the contents of the context object within Custom DB scripts by adding console.log entries to custom db scripts and using the real-time webtask logs to inspect the output.

Solution

The context object for Custom DB does not have the same level of detail as the context object in the rules. It is designed for use with the Organizations feature.

When in an Organization context, the following is within the context object in the login script if enabled for the custom DB:

{ 
    realm: 'Custom DB Name',
    organization: { 
         id: 'org_xxx', 
         name: 'OrgName',
         display_name: 'Test Org', metadata: null
    } 
}

Without an Organization context, only the “realm” value will be available.