Getting user data from client-side for Moralis version2

I am still trying to figure out how to get an user data from a client-side in conjunction with Moralis version2. The code below works fine in ver1. But how can I modify this code when it comes to version2? I couldn’t find the doc that describes “query” ussr data. Would anybody explain me the missing parts?

async function getCurrentUser() {
  const user = Moralis.User.current();
  if (user) {
    console.log("Logged in user:", user);
    console.log(user.get("ethAddress"));
  } else {
    console.log("No user is currently logged in.");
  }
}

getCurrentUser();

the same code should work if you use a self hosted parse server, what you are using as version2 for the server part?

I don’t use self hosted parse server. I am trying to have AWS Lambda/Serverless Framework along with Moralis version2. So will you teach me how can I modify the code above that works on version2? I couldn’t find the doc that describes “query” ussr data.

if you use your own custom implementation then you can make a query to the server/lambda function and then the server will make a query in the database end return the results from the database

you will have a way to identify the current authenticated user like a session token

Could you explain me regarding the code? The code was made and works along with version1. I understand there is a way to do that for version2. But I’m not quite sure how I can do that. So will you teach me how can I modify the code above that works on version2 on my use case? I couldn’t find the doc that describes “query” ussr data.

async function getCurrentUser() {
  const user = Moralis.User.current();
  if (user) {
    console.log("Logged in user:", user);
    console.log(user.get("ethAddress"));
  } else {
    console.log("No user is currently logged in.");
  }
}

getCurrentUser();

It depends on what you use. Are you able to authenticate the user in the first place?

No, I can’t authenticate user.
I need to learn how the logic works in Moralis Version2 that does not use Parse server.

That’s why I’m asking those questions.

What were you able to do by now? Did you use aws lambda before to authenticate users?