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:
_11import Openfort from "@openfort/openfort-js";_11const openfort = new Openfort({_11 baseConfiguration: {_11 publishableKey: OPENFORT_PUBLISHABLE_KEY_11 }_11});_11const address = 'EXTERNAL_WALLET_ADDRESS';_11_11async function initSIWE() {_11 await openfort.initSIWE({address});_11}
Then, verify the SIWE signature to authenticate the user:
walletClientType
: e.g. coinbaseWallet, metamask, etc.connectorType
: wallet_connect_v2, injected, coinbase_wallet, etc.
_16import Openfort from "@openfort/openfort-js";_16const openfort = new Openfort({_16 baseConfiguration: {_16 publishableKey: OPENFORT_PUBLISHABLE_KEY_16 }_16});_16const address = 'EXTERNAL_WALLET_ADDRESS';_16_16async function authSIWE(signature, message, walletClientType, connectorType) {_16 await openfort.authenticateWithSIWE({_16 signature: signature,_16 message: SIWEMessage,_16 connectorType: connector?.type,_16 walletClientType: connector?.name,_16 });_16}
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.