How to use context for scripts in custom db?

There is switch to enable context in scripts for custom databases. Would you mind explaining how to manipulate this context or what’s its intended use? I’m using WebAuth.login function to send credentiales from a customized login page based on the Universal Login, the classic one. When I see the request endpoint it’s going towards …/usernamepassword/login, as expected for this setup. I wonder how can I pass extra info in the login request. I thought I could do that with this context object somehow, but I’m still figuring out how it works. There is confusing info in the docs… saying this context is only available for hooks, rules,actions,etc… not for custom database scripts… but then you see this ‘enable’ context button. When I ‘save and try’ the login script I can see a context object with some stuff in it as a sample (I enabled the context object in database scripts). But no idea how to change it from my frontend or how it works. Thanks for your help!

This is the only thing I can log and I don’t see where this is added.

3 Likes

@benjaminhonorio.12 The context object in custom database scripts currently only supports realm and organization objects, and not custom parameters that is passed with the login request.

See: Create Custom Database Connections

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.