Management API Reference

Authentication

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.

auth.tsx
openfortConfig.ts

_10
import openfort from "./openfortConfig"
_10
_10
const email = 'EMAIL';
_10
const password = 'PASSWORD';
_10
const authToken = 'YOUR_USER_AUTH_TOKEN';
_10
_10
async function linkEmailPassword() {
_10
await openfort.linkEmailPassword({email, password, authToken});
_10
}

Initializes an OAuth linking process.

auth.tsx
openfortConfig.ts

_10
import openfort from "./openfortConfig"
_10
const provider = 'OAuth provider';
_10
const authToken = 'Authentication token';
_10
_10
async function initLinkOAuth() {
_10
await openfort.initLinkOAuth({provider, authToken});
_10
}

Links a wallet using SIWE.

auth.tsx
openfortConfig.ts

_11
import openfort from "./openfortConfig"
_11
_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
_11
async function linkWallet() {
_11
await openfort.linkWallet({signature, message, walletClientType, connectorType, authToken});
_11
}

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.

auth.tsx
openfortConfig.ts

_10
import openfort from "./openfortConfig"
_10
const email = 'EMAIL';
_10
_10
async function unlinkEmailPassword() {
_10
await openfort.unlinkEmailPassword(email);
_10
}

Unlinks an OAuth provider from the account.

auth.tsx
openfortConfig.ts

_10
import openfort from "./openfortConfig"
_10
_10
const provider = 'OAuth provider';
_10
const authToken = 'Authentication token';
_10
_10
async function unlinkOAuth() {
_10
await openfort.unlinkOAuth({provider, authToken});
_10
}

Unlinks a wallet.

auth.tsx
openfortConfig.ts

_10
import openfort from "./openfortConfig"
_10
_10
const address = 'Wallet address';
_10
const authToken = 'YOUR_USER_AUTH_TOKEN';
_10
_10
async function unlinkWallet() {
_10
await openfort.unlinkWallet({provider, address});
_10
}