Hi, I want to check if a user with the currently processing email address exists in a different connection in the tenant, when in a post login action script,. The goal here is to grab a piece of info (app_metadata) from that user if it exists, and copy it over to the user record just created by auth0 in the current connection.
Is this possible?
tyf
August 18, 2023, 2:16am
2
Hey there @auth0rocks welcome to the community (sweet username )!
This will involve using the Management API to search for the user’s email at which point I believe you’d have the information you need.
Here’s some info on how to use the Management API in Actions:
Last Updated: Jul 26, 2024
Overview
This article details how to call the Management API in Actions.
Applies To
Management API
Actions
Solution
Please see the below video.
[How to Use the Management API in Auth0 Actions - Auth0 Support]
There are plans to expand functionality in Actions even more in the future. Currently, the only built-in method for using the Management API from within Actions is for updating user metadata. Use the api object to update user metadata in a pre-use…
And on caching tokens in Actions:
Problem statement: How do I cache a Management API access token(s) using the Node Management Client and Actions caching functionality?
Auth0 recently announced the ability to cache tokens within our extensibility solution, Actions. This has been a much requested feature that we are excited to have finally released. As many users utilize the Node Management Client to interact with the Management API by way of Actions, the question of how to incorporate the new caching functionality has arisen.
S…
Hope this helps!
1 Like
Thanks! Indeed I found a way to do this vai sth like this
const ManagementClient = require('auth0').ManagementClient;
const management = new ManagementClient({
domain: event.secrets.domain,
clientId: event.secrets.clientId,
clientSecret: event.secrets.clientSecret,
});
const userRecords = await management.getUsersByEmail(event.user.email);
thanks
1 Like
tyf
August 18, 2023, 10:50pm
5
Great! Thanks for sharing with the community
1 Like
system
Closed
September 1, 2023, 10:50pm
6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.