Auth0 Home Blog Docs

Is there a way to know which App triggered a Get User action script call?

Hi there,

We have a difficulty where we are attempting to bulk migrate from one legacy database (using the Management API POST /users) and lazily migrating from another using the custom database Login and Get User action scripts. Each of the databases has an associated web application. Is it possible to only have the Login and Get User scripts called for a particular App, or determine in the script which App triggered it to be called? Or is there a better approach that you might suggest for a scenario such as ours?

Thanks,
Jon

Hi @JonHarvey thanks for reaching out!

Are you planning on having a number of applications connect to the db that you’re automatically importing users from? From what it sounds like if you only have one application enabled then those db scripts will only fire if a user is attempting to login through that enabled application.

It’s also worth noting that you could get further information from a rule which would fire during the login process, there you could get access to what application/connection was involved. I’m not sure if you’re looking to store this information or just have it handy for test purposes but that could be an option to explore.

Best Regards,
Colin

Thanks for your response @colin.coutts.

We are planning on having two Web applications connect to the database initially. We are essentially combining two applications with two databases into two applications with one Auth0 database. But the way that we’re achieving that mean we’d like to be aware of which application is calling the Get User script. Can we have a rule run before the Get User script is called and enhance the arguments (or context) passed to the Get User script?

Thanks,
Jon

you can get application_id using this field config.clientID on login page. On basis of application/client_id you can differentiate the request.

1 Like

Thanks a lot for sharing that knowledge here @rashid779939!

1 Like

@rashid779939, thanks for the suggestion but you mentioned the login page, whereas I was referring to the Get User script, which can be called upon Forgot Password or the Sign Up (directly or via the Management API). I did try using the property config.clientID in the Get User script but it did not work (config is undefined). Using configuration.clientID also didn’t work.

Am I missing something here?

If you go through in login page, you will see the whole process. On that page you can check application ID and continue to further flow as required. Because you go to get user script after login page flow completed.

Let us know if you have any other questions!