Hi!
I have a front-end canister calling a shared backend, sometimes I want to send the frontend canister principal to the BE but I got the anonymous user Id instead, here is example:
// FE
constructor(identity) {
const canisterId = process.env.CANISTER_ID_SF_ORDER;
if (identity) {
this.actor = createActor(canisterId, { agentOptions: { identity } });
} else {
this.actor = createActor(canisterId);
}
}
…
const resp = await this.actor.doJobb();
// BE
public shared ({ caller }) func doJobb( …
Error:
Unauthorized caller: 2vxsx-fae. …
Here I am getting the anonymous user, I want the Front-end principal