Home

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.

Links an email and password to an existing account using an authentication token.


_13
import Openfort from "@openfort/openfort-js";
_13
const openfort = new Openfort({
_13
baseConfiguration: {
_13
publishableKey: OPENFORT_PUBLISHABLE_KEY
_13
}
_13
});
_13
const email = 'EMAIL';
_13
const password = 'PASSWORD';
_13
const authToken = 'Authentication token';
_13
_13
async function linkEmailPassword() {
_13
await openfort.linkEmailPassword({email, password, authToken});
_13
}

Initializes an OAuth linking process.


_12
import Openfort from "@openfort/openfort-js";
_12
const openfort = new Openfort({
_12
baseConfiguration: {
_12
publishableKey: OPENFORT_PUBLISHABLE_KEY
_12
}
_12
});
_12
const provider = 'OAuth provider';
_12
const authToken = 'Authentication token';
_12
_12
async function initLinkOAuth() {
_12
await openfort.initLinkOAuth({provider, authToken});
_12
}

Links a wallet using SIWE.


_15
import Openfort from "@openfort/openfort-js";
_15
const openfort = new Openfort({
_15
baseConfiguration: {
_15
publishableKey: OPENFORT_PUBLISHABLE_KEY
_15
}
_15
});
_15
const signature = 'SIWE signature';
_15
const message = 'SIWE message';
_15
const walletClientType = 'Wallet client type';
_15
const connectorType = 'Connector type';
_15
const authToken = 'Authentication token';
_15
_15
async 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.

Unlinks an email and password from an existing account using an authentication token.


_11
import Openfort from "@openfort/openfort-js";
_11
const openfort = new Openfort({
_11
baseConfiguration: {
_11
publishableKey: OPENFORT_PUBLISHABLE_KEY
_11
}
_11
});
_11
const email = 'EMAIL';
_11
_11
async function unlinkEmailPassword() {
_11
await openfort.unlinkEmailPassword(email);
_11
}

Unlinks an OAuth provider from the account.


_12
import Openfort from "@openfort/openfort-js";
_12
const openfort = new Openfort({
_12
baseConfiguration: {
_12
publishableKey: OPENFORT_PUBLISHABLE_KEY
_12
}
_12
});
_12
const provider = 'OAuth provider';
_12
const authToken = 'Authentication token';
_12
_12
async function unlinkOAuth() {
_12
await openfort.unlinkOAuth({provider, authToken});
_12
}

Unlinks a wallet.


_12
import Openfort from "@openfort/openfort-js";
_12
const openfort = new Openfort({
_12
baseConfiguration: {
_12
publishableKey: OPENFORT_PUBLISHABLE_KEY
_12
}
_12
});
_12
const address = 'Wallet address';
_12
const authToken = 'Authentication token';
_12
_12
async function unlinkWallet() {
_12
await openfort.unlinkWallet({provider, address});
_12
}