Integrating with Internet Identity - blog post

You’ve probably seen it by now, but you may be wondering how you can actually use the Internet Identity in your own application. I’ve written up a post on how you can get started using the Internet Identity to make authenticated calls to your service, thanks to our @dfinity/auth-client package.

Hope it’s helpful!

13 Likes

Is it possible to use II for web2 authentication? Here’s what I’m looking for:

  • User logs in with II
  • User signs a message using the session key(?) and submits it to some off-chain backend
  • The backend verifies the signature and recovers the users’ Principal
  • User has now proven ownership of that Principal

Does this make sense? Would this involve get_delegation and prepare_delegation?

3 Likes

+1 I created some pure example with connected internet-identity repo for simple tests
Also hope this is helpful

1 Like

Hi @kpeacock

I seem to be hitting this build error when trying to execute II_ENV=development dfx deploy --no-wallet --argument ‘(null)’

Is there anything I could do to get the build to pass?

I am on dfx 0.7.0

The II application has driven a number of replica changes. I expect you’ll need to upgrade dfx to run a recent II build

Thanks @kpeacock. Ill try this out

I’m trying to figure out how to integrate Internet Identity with a Gatsby site - I followed your @kpeacock tutorial https://kyle-peacock.com/blog/dfinity/static-site-generators-ic/

I have added the webpack stuff to gatsby-node.js

In my index page I’ve imported auth-client and set it up so it’s working locally (it should also work on the network) The Internet Identity page opens and does what it’s meant to do…

In handleAuthenticated I want to createActor, but with the Gatsby site its wired up differently to how I’ve seen other React examples, the Actor is imported in from the declarations in my Gatsby setup…

    import("../declarations/doo")
    .then((module) => {setActor(module.doo)})

From what I’ve seen in other React examples, I need to send the identity as an argument in the options of createActor? I’m not sure how to do that with my setup?! Any tips greatly appreciated :slight_smile:

Yeah, that example has fallen a bit behind. Check out how I handle auth in the IC Avatar application: ic-avatar/hooks.ts at main · krpeacock/ic-avatar · GitHub

1 Like

Great thanks. I’ll update my code