Using the Candid UI when an identity is required

I have many functions in my canister operate on the logged-in user by way of the msg.caller property, for example a function like this:

public shared(msg) func getUserName() : Text {
  return getProfile(msg.caller).name;
}

But when I try to test this function in the auto-generated candid interface, it always uses the anonymous user so I can never test that it’s actually able to find and operate on specific users.

Is it possible to spoof a user in the candid UI so I can test these functions?

4 Likes

Not out of the box, but maybe that’s something @chenyan wants to add? Could be a cool feature and I think @PaulLiu even implemented “login” via pem file for tipjar :thinking:

There is a community project test.icscan.io you can login (via plug) to call canister interface.

Welcome external contribution to add II in Candid UI :slight_smile:

Another option is to use ic-repl's identity command. It has auto-completion based on Candid types, feels like a textual version of Candid UI.

1 Like

Have there been any new developments on this question since April?

For a local deployment ic-repl seems to be the only option.