@dfinity/auth-client

    0.10.0 • Public • Published

    @dfinity/auth-client

    Simple interface to get your web application authenticated with the Internet Identity Service

    Visit the Dfinity Forum and SDK Documentation for more information and support building on the Internet Computer.

    Additional API Documentation can be found here.


    Installation

    Using AuthClient:

    npm i --save @dfinity/auth-client
    

    In the browser:

    import { AuthClient } from "@dfinity/auth-client";
    

    To get started with auth client, run

    const authClient = await AuthClient.create();

    The authClient can log in with

    authClient.login({
      onSuccess: async () => {
        // authClient now has an identity
      },
    });

    It opens an identity.ic0.app window, saves your delegation to localStorage, and then sets you up with an identity.

    Then, you can use that identity to make authenticated calls using the @dfinity/agent Actor.

    const identity = await authClient.getIdentity();
    const actor = Actor.createActor(idlFactory, {
      agent: new HttpAgent({
        identity,
      }),
      canisterId,
    });

    Note: depends on @dfinity/agent, @dfinity/authentication, and @dfinity/identity.

    Install

    npm i @dfinity/auth-client

    DownloadsWeekly Downloads

    839

    Version

    0.10.0

    License

    Apache-2.0

    Unpacked Size

    233 kB

    Total Files

    13

    Last publish

    Collaborators

    • anthony_dfinity
    • dayyildiz
    • eric-swanson-dfinity
    • krpeacock
    • enzoh
    • terrorjack
    • npm-dfinity-org