Login / Register
Connect to Blocto wallet through Flow Client Library (FCL)

Step 1 - Configure FCL

1
import * as fcl from "@onflow/fcl"
2
3
fcl.config()
4
// connect to Flow testnet
5
.put("accessNode.api", "https://access-testnet.onflow.org")
6
// use Blocto testnet wallet
7
.put("challenge.handshake", "https://flow-wallet-testnet.blocto.app/authn")
Copied!
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:
1
import * as fcl from "@onflow/fcl"
2
3
fcl.config()
4
// connect to Flow testnet
5
.put("accessNode.api", "https://access-testnet.onflow.org")
6
// use Blocto testnet wallet
7
.put(
8
"challenge.handshake",
9
"https://flow-wallet-testnet.blocto.app/authn/-/[email protected]"
10
)
Copied!
Starting from @onflow/[email protected] you can also use HTTP/POST to initiate login requests, instead of iframe. Simply modify your wallet connection to:
1
import * as fcl from "@onflow/fcl"
2
3
fcl.config()
4
// connect to Flow testnet
5
.put("accessNode.api", "https://access-testnet.onflow.org")
6
// use Blocto testnet wallet with HTTP/POST
7
.put(
8
"discovery.wallet",
9
"https://flow-wallet-testnet.blocto.app/api/flow/authn"
10
)
11
.put("discovery.wallet.method", "HTTP/POST")
Copied!

Step 2 - Authenticate

1
import * as fcl from "@onflow/fcl"
2
3
fcl
4
.currentUser()
5
.subscribe(console.log) // fires everytime account connection status updates
6
7
// authenticate
8
fcl.authenticate()
Copied!

Step 3 - Unauthenticate

1
import * as fcl from "@onflow/fcl"
2
3
fcl
4
.currentUser()
5
.subscribe(console.log) // fires everytime account connection status updates
6
7
// unauthenticate and clear account info in FCL
8
fcl.unauthenticate()
Copied!
Last modified 21d ago