Get member email not always working - why?

Any idea why this code does not always return the members logged in email please? Sometimes returns nothing I am a newbie

async function getEmail () {

const member = await currentMember.getMember();

let email= member.loginEmail;
const first_name = member.contactDetails.firstName;
const last_name = member.contactDetails.lastName;
const full_name = first_name + "." + last_name + "." + email;



$w("#input11").value = full_name;

$w("#text39").text = email;

local.setItem("email", email);

return email;
};

Is it anything to do with how members is logged in e.g. with an email or Google account?