Skip to main content

Create a User with Email Only

1. Initialize Turnkey

import { Turnkey, TurnkeySDKBrowserConfig } from "@turnkey/sdk-browser";
import turnkeyConfig from "./turnkey.json"

const turnkey = new Turnkey(turnkeyConfig);

2. Configure the SubOrganization 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
}
};

3. 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.