AliSci
January 3, 2023, 2:17pm
1
how to run the internet identity locally for testing, without docker internet-identity/HACKING.md at main · dfinity/internet-identity · GitHub
To run the identity provider locally
git clone https://github.com/dfinity/internet-identity#integration-with-internet-identity
cd internet-identity
./scripts/docker-build
cargo install ic-cdk-optimizer --version 0.3.4
npm ci
dfx start
7.II_FETCH_ROOT_KEY=1 dfx deploy --no-wallet --argument '(null)'
after step 7 i got this error
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
Also, i got this interesting message in the logs
(node:93108) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.
If it can help and assuming with “testing” you mean deploying locally II, I documented various way to deploy and use it locally (without docker) in following blog post:
Easiest being adding following in dfx
:
"internet_identity": {
"type": "custom",
"candid": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity.did",
"wasm": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_dev.wasm",
"shrink": false,
"remote": {
"candid": "internet_identity.did",
"id": {
"ic": "rdmx6-jaaaa-aaaaa-aaadq-cai"
}
}
}
}
1 Like
AliSci
January 4, 2023, 2:49am
3
How can I use that? Can I do it like this?
how to run the internet identity locally for testing, without docker internet-identity/HACKING.md at main · dfinity/internet-identity · GitHub
in dfx.json
add this
"internet_identity": {
"type": "custom",
"candid": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity.did",
"wasm": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_dev.wasm",
"shrink": false,
"remote": {
"candid": "internet_identity.did",
"id": {
"ic": "rdmx6-jaaaa-aaaaa-aaadq-cai"
}
}
},
after that you can use the identity host like this
let identityProvider = "https://identity.ic0.app/#authorize";
if (process.env.DFX_NETWORK != "ic") {
identityProvider = "http://127.0.0.1:4943/?canisterId=rkp4c-7iaaa-aaaaa-aaaca-cai&id=r7inp-6aaaa-aaaaa-aaabq-cai"
}
return await authClient.login({
identityProvider,
onSuccess: () => {
window.location.reload()
}
});
I tried that but when I click login it shows me this, there is no login ui just the canister ui?
Oh that’s good sign, it means the canister was deployed but you picked the wrong canister ID. It happened to me too, the dfx
output is a bit confusing.
The output is actually the candid explorer output, what you get in your screenshot. The effective canister ID deployed is the one indicated with param id=
not the one with canisterId=
(see my screenshot here).
So in your above snippet, instead of
identityProvider = "http://127.0.0.1:4943/?canisterId=rkp4c-7iaaa-aaaaa-aaaca-cai&id=r7inp-6aaaa-aaaaa-aaabq-cai
You can probably use
identityProvider = "http://127.0.0.1:4943/?canisterId=r7inp-6aaaa-aaaaa-aaabq-cai
Alternatively, if you don’t care about developing in Safari, you can also use the canisterId as sub-domain like http://r7inp-6aaaa-aaaaa-aaabq-cai.127.0.0.1:4943/
.
2 Likes
AliSci
January 4, 2023, 6:43am
5
I need to see something like this!
However, using the
http://127.0.0.1:4943/?canisterId=rkp4c-7iaaa-aaaaa-aaaca-cai
without the
&id=<id value>
results in blanck white page like this
here are my canisters
I wasn’t unsure because I assumed agent-js adds it, but can you try to add #authorize
to the identity provider?
let identityProvider = "https://identity.ic0.app/#authorize";
if (process.env.DFX_NETWORK != "ic") {
identityProvider = "http://r7inp-6aaaa-aaaaa-aaabq-cai.127.0.0.1:4943?#authorize"
}
return await authClient.login({
identityProvider,
onSuccess: () => {
window.location.reload()
}
});
does that help?
if not, is your project open source? can you provide the link to your repo?
AliSci
January 4, 2023, 7:07am
7
I would be grateful we are having a divinity grant you can get some if you can help
Thanks. Unfortunately I was not able to deploy your project and branch GitHub - aliscie/autodox-tauri at ali/ic locally. When I do so I get various errors.
From the code, I noticed that my last suggestion above was not the one coded, didn’t it work out? Did you gave it a try?
identityProvider = "http://r7inp-6aaaa-aaaaa-aaabq-cai.127.0.0.1:4943?#authorize"
AliSci
January 4, 2023, 11:03am
9
Yeah I tried it, it just go to google, like it is invalid url
Mmmh hard to tell what is not correct in your app without being able to deploy it unfortunately.
Not later than this morning I answered the same question (How to get the Internet Identity ID dynamically? - #11 by peterparker ) and such an url worked out.
AliSci
January 4, 2023, 11:50am
11
oh gash solved now it is workin
for some reason using localhost
instead of 127.0.0.1
made it works
identityProvider = “http://r7inp-6aaaa-aaaaa-aaabq-cai.localhost:4943?#authorize ”`
3 Likes
Ah cool, happy to hear it worked out!!!
Kind of weird, I remember few weeks ago I had to do the contrary locally to call a canister (not II) - i.e. I had to explicitely switch to 127.0.0.1 instead of localhost
2 Likes
@AliSci sorry for the delay! I was out for a bit, but I see our local hero @peterparker was able to help. I can also confirm that @peterparker ’s suggestion of using remote canisters (described in the blog post linked above ) is probably 100x easier than doing the docker build yourself!
Also, if you do go the route of the docker build in the future, note that you do not need to install ic-cdk-optimizer
, since that’s already taken care of by the docker build. Out of curiosity, which instructions did you follow? It’d be worth clarifying!
AliSci
January 5, 2023, 2:00pm
14
yeah his solution is perfect, and I hate docker
3 Likes
Fulco
April 13, 2023, 12:56pm
15
@nmattia Just wanted to drop another datapoint here that I was encountering the same issue as @AliSci
I add the II dev canister in dfx.json as
"internet_identity": {
"type": "custom",
"candid": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity.did",
"wasm": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_dev.wasm",
"remote": {
"id": {
"ic": "rdmx6-jaaaa-aaaaa-aaadq-cai"
}
}
}
However when I try to login locally with
await authClient.login({
identityProvider: 'http://127.0.0.1:4943/?canisterId=r7inp-6aaaa-aaaaa-aaabq-cai'
});
I get the candidUI frontend but with an II purple gradient background.
while if I use localhost
await authClient.login({
identityProvider: 'http://localhost:4943/?canisterId=r7inp-6aaaa-aaaaa-aaabq-cai'
});
I got the expected II devbuild frontend.
I think importing the devbuild like this in dfx.json is a really smooth experience, but this turned it into something frustrating which others might run into as well.
Browser: Arc with Chromium Engine Version 112.0.5615.49
OS: Macos 13.2.1 (22D68) M1 pro
Frontend framework: sveltekit
dfx 0.12.1
1 Like
This worked for me too,i think it’s based on device configuration