II & NFID public domains?

this code snippet is from NFID-SDK demo repo example:

import { AuthButton } from "./AuthButton"
import { InternetIdentityProvider } from "@internet-identity-labs/react-ic-ii-auth"
import React from "react"

const NFIDUrl = process.env.REACT_APP_NFID_PROVIDER_URL

// Note: This is just a basic example to get you started
function Auth() {
  const [provider, setProvider] = React.useState<"II" | "NFID" | null>(null)

  return (
    <div>
      <div className="auth-section">
        {!provider || provider === "II" ? (
          <InternetIdentityProvider
            authClientOptions={{
              maxTimeToLive: BigInt(Date.now() + 7 * 24 * 60 * 60 * 1e9),
              identityProvider:
                "https://nprnb-waaaa-aaaaj-qax4a-cai.ic0.app/#authorize",
              windowOpenerFeatures:
                `left=${window.screen.width / 2 - 525 / 2}, ` +
                `top=${window.screen.height / 2 - 705 / 2},` +
                `toolbar=0,location=0,menubar=0,width=525,height=705`,
              onSuccess: (principal) => {
                setProvider("II")
              },
            }}
          >
            <AuthButton reset={() => setProvider(null)} provider="II" />
          </InternetIdentityProvider>
        ) : null}
        {!provider || provider === "NFID" ? (
          <InternetIdentityProvider
            authClientOptions={{
              maxTimeToLive: BigInt(Date.now() + 7 * 24 * 60 * 60 * 1e9),
              identityProvider: NFIDUrl as string,
              windowOpenerFeatures:
                `left=${window.screen.width / 2 - 525 / 2}, ` +
                `top=${window.screen.height / 2 - 705 / 2},` +
                `toolbar=0,location=0,menubar=0,width=525,height=705`,
              onSuccess: (principal) => {
                setProvider("NFID")
              },
            }}
          >
            <AuthButton reset={() => setProvider(null)} provider="NFID" />
          </InternetIdentityProvider>
        ) : null}
      </div>
    </div>
  )
}

export { Auth }

in this hard coded identityProvider is defined, which is deployed locally by the canister code which in repo itself. but is there any public canister to handle all this?
and even in local we can use that same canister so in local or production application not have to defined/deploy our own canister for internet identity and NFID?

also why it is recommended to deploy internet identity & NFID canister for local development if there is public alternative to it? just curious because it add extra layer of learning curve and requires bit more setup in local.

1 Like

@jaesharma The reason we recommend deploying II and NFID canisters locally is because delegations returned from ICP mainnet are not usable locally. This is an ICP development restriction and yes, it unfortunately leads to a more complicated learning curve.

You’ll need local II/NFID canisters if you want to use their returned delegations in local development (i.e. to execute authenticated calls in your local development canisters).

Does that answer your question?

yes it does. thanks for the detailed response.
is there any easy way to deploy NFID SDK canister similar to internet identity.
in II i can add canister like this in dfx.json and it’ll handle all local II related things by itself.

    "internet_identity": {
      "type": "custom",
      "candid": "https://github.com/dfinity/internet-identity/releases/download/release-2024-04-15/internet_identity.did",
      "wasm": "https://github.com/dfinity/internet-identity/releases/download/release-2024-04-15/internet_identity_dev.wasm.gz",
      "remote": {
        "id": {
          "ic": "rdmx6-jaaaa-aaaaa-aaadq-cai"
        }
      },
      "frontend": {}
    }

is there anything similar for NFID?