External Wallet Login
Learn how to connect the external wallets to onboard users.
Connect wallet via the Sign in With Ethereum (SIWE) standard. Catered to users who prefer to authenticate using their external wallets, supporting various types such as injected, browser-based, and mobile wallets. Openfort’s integration facilitates a secure and direct authentication process using these wallets.
First create a challenge for the user to sign with their wallet by constructing a SIWE challenge using the nonce returned from the server:
_10import Openfort from "@openfort/openfort-js";_10const openfort = Openfort('YOUR_OPENFORT_PUBLISHABLE_KEY');_10const address = 'EXTERNAL_WALLET_ADDRESS';_10_10async function initSIWE() {_10 await openfort.initSIWE(address);_10}
Then, verify the SIWE signature to authenticate the user:
walletClientType
: e.g. coinbaseWallet, metamask, etc.connectorType
: wallet_connect_v2, injected, coinbase_wallet, etc.
_10import Openfort from "@openfort/openfort-js";_10const openfort = Openfort('YOUR_OPENFORT_PUBLISHABLE_KEY');_10const address = 'EXTERNAL_WALLET_ADDRESS';_10_10async function authSIWE(signature, message, walletClientType, connectorType) {_10 await openfort.authenticateWithSIWE(signature, message, walletClientType, connectorType);_10}
And you’re done! The user is now authenticated and can access your application.
Uppon successful authentication, the SDK will return a token that can be used to authenticate the user in your application.