How can i use II in android or IOS native env?

I want to build a app where my users can natively use the same Principal as my website from Internet Identity. Can i do this?
I found some tutorial in google’s Android website. It says that app can use that same webauthn credential in some situations.

Sign in your user with Credential Manager | Android Developers

In order for this to happen, you’ll need two things:

  • The same “target” identity in both your website and your app
  • The ability to delegate to your website via the browser + webauthn, and then to pass that delegation back to your app.

By default, the auth client will generate an ECDSAKeyIdentity for your user if none is available. This won’t serve your purposes, since that API makes it non-exportable.

Instead, you will want to create your shared identity first (maybe using a seed phrase with Secp256k1KeyIdentity) and then pass that during AuthClient.create({identity})

Hi @famouscat8

Yes, this is possible. You can take a look at the example here, to see how to integrate a native iOS app with Internet Identity.

Since you need to delegate to the browser anyway for the authentication flow, you just need to make sure that you use the same domain in both instances (or make use of the alternative origins feature).

Note that your service does not interact with WebAuthn credentials directly, if it authenticates via II (in that case II owns the credentials).

1 Like