Identify user Logged

hello greetings. How can I identify the user logged in to monday.com? so far using the api I have not been able to get the user’s email. I will listen to any suggestion. thank you very much.

ji @isrraelRios

It depends if you are talking about a (board) view or an integration app.

For a (board) view (in React) you can do something like:

  useEffect(() => {
    fetchContextDetails();
    monday.api(`query { me { name id email }}`).then((response) => {
      setUserDetails(response?.data?.me);
    });
  }, []);

For an integration you can do this by using a custom action that has a User input and takes this input from the trigger.

1 Like

Thank you @basdebruin!

@isrraelRios is that what you were looking for?

thanks Bas. The problem I have is that when using a personal token this algorithm brings me the data of the token owner. let me give you more detail. I have a HTLM endebbed panel and I use it to create a menu with selectable options. but the options change depending on the user that is logged in and using the panel. how do I identify the user that is interacting with the HTML panel without using a personal token?
sorry, my english is not good.

hi @israeloby

Why do you need to use a personal token when you have a session token? The example given is querying the current user in the useEffect, not using a token.

do you verify the sessionToken with jwt?

If you only do monday.api call you don’t need a token at all (the user is already authenticated as he/she is logged in to monday.com. If you make call to external services and want to authenticate the monday user at this external service you can use the sessionToken which you obtain through:

      monday.get("sessionToken").then((res) => {
        setMyToken(res.data);
          "https://some-external-service"
          { method: "GET", headers: { Authorization: res.data, Accept: "application/json" } }
        )
          .then((response) => response.json())
          etc....
      });

sorry maybe I’m doing it wrong since I’m working inside an html Embedded® and I don’t fully know the capabilities of this app yet. I am not working with react but with vanilla JS inside the tags which is what the html allows me to do. I have not yet been able to get your suggestion to work. From this context is that I want to identify the user.