Skip to main content

Manually generating a link

You can use our backend SDK to generate magic links as shown below:

import Passwordless from "supertokens-node/recipe/passwordless";

async function createMagicLink(email: string) {
const magicLink = await Passwordless.createMagicLink({email, tenantId: "public"});

console.log(magicLink);
}
Multi Tenancy

Notice that we pass in the "public" tenantId to the function call above - which is the default tenantId.

If you are using our multi tenancy feature, you can pass in another tenantId which will be embedded in the link by SuperTokens. This will ensure that when the user clicks on the link and signs up, they sign up to the tenant you want to give them access to.

Note that the generated link will use the configured websiteDomain from the appInfo object (in supertokens.init), however, you can change the domain of the generated link to match that of the tenant ID.

Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI