Puoi utilizzare:
const user = api.getCurrentUser() if(user) { return user.username; }
Maggiori informazioni qui: