Login / Register

Connect to Blocto wallet through Flow Client Library (FCL)

Step 1 - Configure FCL

import * as fcl from "@onflow/fcl"
fcl.config()
// connect to Flow testnet
.put("accessNode.api", "https://access-testnet.onflow.org")
// use Blocto testnet wallet
.put("challenge.handshake", "https://flow-wallet-testnet.blocto.app/authn")

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 handshake URL instead:

import * as fcl from "@onflow/fcl"
fcl.config()
// connect to Flow testnet
.put("accessNode.api", "https://access-testnet.onflow.org")
// use Blocto testnet wallet
.put(
"challenge.handshake",
"https://flow-wallet-testnet.blocto.app/authn/-/[email protected]"
)

Step 2 - Authenticate

import * as fcl from "@onflow/fcl"
fcl
.currentUser()
.subscribe(console.log) // fires everytime account connection status updates
// authenticate
fcl.authenticate()

Step 3 - Unauthenticate

import * as fcl from "@onflow/fcl"
fcl
.currentUser()
.subscribe(console.log) // fires everytime account connection status updates
// unauthenticate and clear account info in FCL
fcl.unauthenticate()