EOSCommunity.org Forums

Anchor not returning actor on login

I’m trying to add Anchor Login on my dapp and started with the simple example from git.
Scanning QR and transfer EOS works fine. But I don’t get an EOS account name returned in the session.auth.actor. How can I get the eos-account name that signed in?

function didLogin() {
document.getElementById(‘account-name’).textContent = session.auth.actor
document.body.classList.add(‘logged-in’)
}

AnchorActorRetObj

It’s the proper value, it’s just being returned as a Name type. Just convert it to a string:

String(session.auth.actor)

e.g.

function didLogin() {
   document.getElementById(‘account-name’).textContent = String(session.auth.actor)
   document.body.classList.add(‘logged-in’)
}

Great! That worked. Thanks :slight_smile: