Linking accounts
Manage the identities associated with your user.
The user identity represents an authentication method associated to the user. For example, if a user signs in using their email, an email identity will be associated with the user.
Linking additional accounts#
Developers can use Openfort to prompt users to link additional accounts (such as a wallet or Discord profile) at any point in their user journey, not just during login.
Link email#
Links an email and password to an existing account using an authentication token.
_13import Openfort from "@openfort/openfort-js";_13const openfort = new Openfort({_13 baseConfiguration: {_13 publishableKey: OPENFORT_PUBLISHABLE_KEY_13 }_13});_13const email = 'EMAIL';_13const password = 'PASSWORD';_13const authToken = 'Authentication token';_13_13async function linkEmailPassword() {_13 await openfort.linkEmailPassword({email, password, authToken});_13}
Link social accounts#
Initializes an OAuth linking process.
_12import Openfort from "@openfort/openfort-js";_12const openfort = new Openfort({_12 baseConfiguration: {_12 publishableKey: OPENFORT_PUBLISHABLE_KEY_12 }_12});_12const provider = 'OAuth provider';_12const authToken = 'Authentication token';_12_12async function initLinkOAuth() {_12 await openfort.initLinkOAuth({provider, authToken});_12}
Link wallets#
Links a wallet using SIWE.
_15import Openfort from "@openfort/openfort-js";_15const openfort = new Openfort({_15 baseConfiguration: {_15 publishableKey: OPENFORT_PUBLISHABLE_KEY_15 }_15});_15const signature = 'SIWE signature';_15const message = 'SIWE message';_15const walletClientType = 'Wallet client type';_15const connectorType = 'Connector type';_15const authToken = 'Authentication token';_15_15async function linkWallet() {_15 await openfort.linkWallet({signature, message, walletClientType, connectorType, authToken});_15}
Unlinking accounts#
Once a user has linked additional accounts to their profile, you may also want to give them the option to unlink those accounts.
Unlink email#
Unlinks an email and password from an existing account using an authentication token.
_11import Openfort from "@openfort/openfort-js";_11const openfort = new Openfort({_11 baseConfiguration: {_11 publishableKey: OPENFORT_PUBLISHABLE_KEY_11 }_11});_11const email = 'EMAIL';_11_11async function unlinkEmailPassword() {_11 await openfort.unlinkEmailPassword(email);_11}
Unlink social accounts#
Unlinks an OAuth provider from the account.
_12import Openfort from "@openfort/openfort-js";_12const openfort = new Openfort({_12 baseConfiguration: {_12 publishableKey: OPENFORT_PUBLISHABLE_KEY_12 }_12});_12const provider = 'OAuth provider';_12const authToken = 'Authentication token';_12_12async function unlinkOAuth() {_12 await openfort.unlinkOAuth({provider, authToken});_12}
Unlink wallets#
Unlinks a wallet.
_12import Openfort from "@openfort/openfort-js";_12const openfort = new Openfort({_12 baseConfiguration: {_12 publishableKey: OPENFORT_PUBLISHABLE_KEY_12 }_12});_12const address = 'Wallet address';_12const authToken = 'Authentication token';_12_12async function unlinkWallet() {_12 await openfort.unlinkWallet({provider, address});_12}