Question: How to find identity address for logged in user?

Hey there,

I logged in with the blockstack browser, should I only allow registered IDs in blockstack explorer? how can I retrieve the ID to check in api, if the ID is registered, my object does not return the ID?

Hey @renatoayres.id

Is the question you’re asking “how to find the identity address for the logged in user?”

After successful login, you can call loadUserData() which will return a userData object with the fields:

{ username,
  profile,
  decentralizedID,
  identityAddress,
  appPrivateKey,
  authResponseToken,
  hubUrl }

The identity address is stored in the identityAddress field of that object (e.g., for blankstein.id, that’s 15GAGiT2j2F1EzZrvjk3B8vBCfwVEzQaZx) — you can confirm that by querying API endpoints on a blockstack-core node: https://core.blockstack.org/v1/names/blankstein.id

1 Like

Hey @arron

I got good results thanks for your help !!

There are two ways to call the method

var person = new blockstack.loadUserData(profile);
var profile = blockstack.loadUserData().profile; the second return ID.