Linking & unlinking 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.
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.
Links an email and password to an existing account using an authentication token.
Javascript
_10 import openfort from "./openfortConfig"
_10 const email = 'EMAIL';
_10 const password = 'PASSWORD';
_10 const authToken = 'YOUR_USER_AUTH_TOKEN';
_10 async function linkEmailPassword() {
_10 await openfort.linkEmailPassword({email, password, authToken});
Initializes an OAuth linking process.
Javascript
_10 import openfort from "./openfortConfig"
_10 const provider = 'OAuth provider';
_10 async function initLinkOAuth() {
_10 await openfort.initLinkOAuth({provider});
Links a wallet using SIWE.
Javascript
_11 import openfort from "./openfortConfig"
_11 const signature = 'SIWE signature';
_11 const message = 'SIWE message';
_11 const walletClientType = 'Wallet client type';
_11 const connectorType = 'Connector type';
_11 const authToken = 'YOUR_USER_AUTH_TOKEN';
_11 async function linkWallet() {
_11 await openfort.linkWallet({signature, message, walletClientType, connectorType, authToken});
Links a third party provider to an existing account using an authentication token.
Javascript
_10 import openfort from "./openfortConfig"
_10 const provider = 'Third Party provider';
_10 const token = 'Third Party token';
_10 const tokenType = 'Type of the token (idToken or customToken)'
_10 async function linkThirdParty() {
_10 await openfort.linkThirdPartyProvider({provider, token, tokenType});
Once a user has linked additional accounts to their profile, you may also want to give them the option to unlink those accounts.
Unlinks an email and password from an existing account using an authentication token.
Javascript
_10 import openfort from "./openfortConfig"
_10 const email = 'EMAIL';
_10 async function unlinkEmailPassword() {
_10 await openfort.unlinkEmailPassword(email);
Unlinks an OAuth provider from the account.
Javascript
_10 import openfort from "./openfortConfig"
_10 const provider = 'OAuth provider';
_10 async function unLinkOAuth() {
_10 await openfort.unLinkOAuth({provider});
Unlinks a wallet.
Javascript
_10 import openfort from "./openfortConfig"
_10 const address = 'Wallet address';
_10 const authToken = 'YOUR_USER_AUTH_TOKEN';
_10 async function unlinkWallet() {
_10 await openfort.unlinkWallet({provider, address});
Unlinks a third party provider from an existing account using an authentication token.
Javascript
_10 import openfort from "./openfortConfig"
_10 const provider = 'Third Party provider';
_10 const token = 'Third Party token';
_10 const tokenType = 'Type of the token (idToken or customToken)'
_10 async function unlinkThirdParty() {
_10 await openfort.unlinkThirdPartyProvider({provider, token, tokenType});