I am trying to configure alternative origin(“https://icevent.app”) for canister https://znisf-eqaaa-aaaaj-aabta-cai.raw.ic0.app/ by following instruction https://internetcomputer.org/docs/current/developer-docs/integrations/internet-identity/alternative-origins#configuring-alternative-origins , but it doesn’t show the origin as document when I try to login with domain (“icevent.app”), still get the different principal.
my configurations as below, anyone can help me?
ii-alternative-origins file:
{
“alternativeOrigins”: [
“https://icevent.app”,“https://www.icevent.app”
]
}
levi
2
doesn’t work
authClient.login({
derivationOrigin: "https://znisf-eqaaa-aaaaj-aabta-cai.raw.ic0.app",
identityProvider: IDENTITY_PROVIDER,
maxTimeToLive: ONE_WEEK_NS,
onSuccess: () => handleAuthenticated(authClient),
});
Are you using dfx and if yes, did you proceed with the all configuration including the chapter " Configuring Your Asset Canister"
Then, configure the .well-known directory to be included, with
[
{
“match”: “.well-known”,
“ignore”: false
},
{
“match”: “.well-known/ii-alternative-origins”,
“headers”: {
“Access-Control-Allow-Origin”: “*”,
“Content-Type”: “application/json”
},
“ignore”: false
}
]
Good.
Also https://znisf-eqaaa-aaaaj-aabta-cai.raw.ic0.app/.well-known/ii-alternative-origins seems ok.
Final piece, did you pass the derivation origin to agent-js?
await authClient.login({
...
derivationOrigin: "https://your-url.ic0.app"
where https://your-url.ic0.app
is the original domain used to sign-in - i.e. the domain you want to use to get the same principal
1 Like
yes, like this
authClient.login({
derivationOrigin: "https://znisf-eqaaa-aaaaj-aabta-cai.raw.ic0.app",
identityProvider: IDENTITY_PROVIDER,
maxTimeToLive: ONE_WEEK_NS,
onSuccess: () => handleAuthenticated(authClient),
});
1 Like
What version of agent-js are you using?
Did you re-deploy?
When I go to https://icevent.app/ and open and debug II, I can notice that no derivationOrigin
is passed.
So either agent-js is not well configured, or not redeployed or it does not pass the information but that’s where the issue is I think.
2 Likes
it works now!
I used version 0.11.3, now changed to 0.13.0
thanks YOU!
1 Like
Out of curiosity, you mean dfx?
Glad to hear it worked out
No, my dfx is 0.12.1, but agent.js was old 0.11
2 Likes