Documentation Index
Fetch the complete documentation index at: https://docs.turnkey.com/llms.txt
Use this file to discover all available pages before exploring further.
⚠️ This example is outdated !
Head over to SDK Reference for the updated packages.
Initialize Turnkey
import { Turnkey } from "@turnkey/sdk-browser";
const turnkey = new Turnkey({
apiBaseUrl: "https://api.turnkey.com",
defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID,
});
Configure the Sub Organization for the User
import { DEFAULT_ETHEREUM_ACCOUNTS } from "@turnkey/sdk-browser;"
const subOrganizationConfig = {
subOrganizationName: <subOrganizationName>,
rootUsers: [{
userName: <userEmail>,
userEmail: <userEmail>,
apiKeys: [],
authenticators: [],
oauthProviders: []
}],
rootQuorumThreshold: 1,
wallet: {
walletName: <walletName>,
accounts: DEFAULT_ETHEREUM_ACCOUNTS
}
};
Call createSubOrganization from your backend
await turnkey.serverSign("createSubOrganization", [subOrganizationConfig]);
This is all that is needed to create a user without any authentication credential other than their email address, in the login flow you can see how to then authenticate the user after their subOrganization is created.