candid icon indicating copy to clipboard operation
candid copied to clipboard

Add II login to Candid UI for authenticated calls

Open Web3NL opened this issue 2 years ago • 2 comments

Requires a canister to implement http_request method and serve /.well-known/ii-alternative-origins with https://a4gq6-oaaaa-aaaab-qaa4q-cai.raw.icp0.io as an origin, as I currently understand.

If this is a good idea and there is support for this feature, I'm willing to start working on a PR.

Web3NL avatar Oct 08 '23 22:10 Web3NL

Sounds like a good feature. Looking forward to your PR :)

chenyan-dfinity avatar Oct 09 '23 01:10 chenyan-dfinity

See this demo and forked repo

For testing I have a canister with:

http_request query method with update = ?true (see upgrade to update)

http_request_update and serves /.well-known/ii-alternative-origins with my self deployed candid ui canister as an alternative origin

hello query method that only answers if caller = allowed

setter and getter for var allowed: Principal

To test: Open the demo

Query the hello method. This should give an error

Login with your II and copy your principal id

Paste in _set_allowed_principal and submit

Query the hello method

Next steps Some more testing (hopefully local Docker testing with Selenium for local alternative origins testing) UI touches Gather feedback

Web3NL avatar Oct 09 '23 19:10 Web3NL