How to authenticate with oisy-wallet-signer

  1. What we want to do
    • Let the user sign in with their wallet.
    • Get an “identity” we can use when we talk to any canister.

  2. Step-by-step code

TypeScript

Copy

// 1. Bring in the helpers
import { IcpWallet } from '@dfinity/oisy-wallet-signer/icp-wallet';

// 2. Connect the wallet once (e.g., in an async function)
const wallet = await IcpWallet.connect({
  url: walletUrl.value,        // “https://wallet.oisy.com” (or whatever you show the user)
  onDisconnect: () => {        // runs when user logs out of the wallet
    console.log('Wallet was closed or logged out');
  },
});

// 3. Grab an identity that can be used with ANY canister
const oisyIdentity = wallet.identity;   // <-- this is the magic “oisy identity”

// 4. Use that identity when you create an actor
import { createActor } from 'declarations/my_canister';  // auto-generated or your own helper

const actor = createActor(canisterId, {
  agentOptions: { identity: oisyIdentity },  // plug the wallet identity in here
});

You cannot. OISY does not support session delegation (ICRC-34).

that is fine, but how to connect, I don’t want to use internet identity I want to use oisy login

Let me try to rephrase my previous answer: You cannot use OISY to delegate a session, derive an identity — i.e. you cannot use OISY for logging into your dapps.

1 Like