AuthClient return anonymous Identity instead of logged in

when logging in, i get this in my browser and the returned identity is anonymous instead of the logged in user

WARNING: expected origin ‘’, got ‘’ (ignoring)

how to solve?

my code:

async function loginScript (event)


let authClient = await AuthClient.create();
// start the login process and wait for it to finish
await new Promise((resolve) => {
            process.env.DFX_NETWORK === "ic"
                ? ""
                : `http://rdmx6-jaaaa-aaaaa-aaadq-cai.localhost:4943`,
        onSuccess: resolve ,
const identity = authClient.getIdentity();

const agent = new HttpAgent({ identity });
actor = await createActor(process.env.CANISTER_ID_DCE_BACKEND, {

I think you need to specify the host in the HttpAgent to point to localhost

SOLVED: i mixed up two examples, solved now :man_facepalming: