Blocto
About porttoBlog
  • 📣Introduction
  • Blocto Environment
  • Give Feedback
  • BLOCTO SDK
    • Overview
    • JavaScript SDK
      • Flow
        • Tutorial
        • Configure FCL
        • Authenticate / Unauthenticate
        • Send Transaction
        • Account Proof
        • Flow Networks
        • Verified Transaction
        • Migration Guide
  • Blocto App
    • Deep Linking
    • Token Listing
    • NFT Listing (on Flow)
  • Technical Documents
    • Key Management
  • BloctoSwap
    • Token Listing
  • Support
    • Contact Us
    • Web Wallet v1 Sunset Notice and Migration Guide
  • Community
    • Discord
    • Twitter
    • Facebook
Powered by GitBook
On this page
  • Step 1 - Configure FCL
  • Step 2 - Authenticate
  • Step 3 - Unauthenticate

Was this helpful?

  1. BLOCTO SDK
  2. JavaScript SDK
  3. Flow

Authenticate / Unauthenticate

Connect to Blocto wallet through Flow Client Library (FCL)

Step 1 - Configure FCL

import * as fcl from "@blocto/fcl";

fcl.config({
  "accessNode.api": "https://rest-testnet.onflow.org", // connect to Flow testnet
  "discovery.wallet": `https://wallet-v2-dev.blocto.app/-/flow/authn` // use Blocto testnet wallet
});

Alternatively, if you already have user's email and would like to pre-fill it for user's Blocto account, you can use the custom discovery.wallet URL instead:

import * as fcl from "@blocto/fcl";

const USER_EMAIL = "client@email.com";

fcl.config({
  "accessNode.api": "https://rest-testnet.onflow.org", // connect to Flow testnet
  "discovery.wallet": `https://wallet-v2-dev.blocto.app/-/flow/authn/${USER_EMAIL}` // use Blocto testnet wallet
});

Step 2 - Authenticate

import * as fcl from "@blocto/fcl";

// fires everytime account connection status updates
fcl.currentUser().subscribe(console.log);

// authenticate
fcl.authenticate();

Step 3 - Unauthenticate

import * as fcl from "@blocto/fcl";

// fires everytime account connection status updates
fcl.currentUser().subscribe(console.log);

// unauthenticate and clear account info in FCL
fcl.unauthenticate();
PreviousConfigure FCLNextSend Transaction

Last updated 27 days ago

Was this helpful?