Choose the sign-in methods
This guide explains how to choose the sign-in methods that the sign-in page of an application offers, in which order, and with which restrictions.
Learning outcomes
- Add, remove, and order sign-in methods.
- Restrict a method with a rule.
- Let users sign in with a link sent by email.
What you need
- An application
About sign-in methods
The Signin methods table of an application lists the methods on its sign-in page, in order. The available methods include Password, Verification code, Magic link, WebAuthn, LDAP, Face ID, Device login, and WeChat. A new application has Password, Verification code, WebAuthn, and Face ID. Add the other methods yourself. An application needs at least one method.

| Column | Description |
|---|---|
| Name | Method |
| Display name | Label that users see |
| Rule | Restriction of the method. See Method rules |
| Action | Move the row up or down, or delete it |
Configure the methods
- In the Casdoor admin console, open the edit page of the application.
- In Signin methods, add, remove, and order the methods.
- Optionally, change the display name of a method and select a rule.
- Save the application.
For example, to prefer sign-in with an email code and offer the password second:
- Put Verification code first and Password second.
- Set the rule of Verification code to
Email only, so that the code goes only by email. - Set the display name of Verification code to a clear label, such as
Email login.

The sign-in page then looks like this:

Method rules
| Method | Rules | Description |
|---|---|---|
| Password | All (default), Non-LDAP, Hide password | All: LDAP users can sign in with their password. Non-LDAP: LDAP users can't use password sign-in. Hide password: turns password sign-in off, see Hide password sign-in. |
| Verification code | All (default), Email only, Phone only | Which channel to use for the code: both, email only, or phone only. |
| Magic link | Sign in only (default), Sign in or sign up | Sign in only signs in existing users. Sign in or sign up also creates an account for an unknown email address. See Sign in with a magic link. |
| Device login | Tab (default), Login page | Tab shows the device login QR code in its own tab. Login page shows it next to the sign-in form, so users signed in to your mobile app can scan it to sign in to the website. |
Tab (default), Login page | Tab shows the WeChat QR code in its own tab. Login page shows it below the sign-in form. Both need a WeChat provider in the Providers of the application. See WeChat. |
A native app can sign users in with a verification code without opening the sign-in page. Turn on the verification code grant, which also signs up phone numbers and email addresses that have no account yet.
Limit code sign-in to groups
You can offer sign-in with a verification code or a magic link to some users only, for example to those who struggle with passwords, while administrators keep signing in with a password and MFA:
- On the UI Customization tab of the application, make sure Signin methods has Verification code or Magic link.
- In Code signin groups, select the groups whose members may use them.
- Save the application.
Casdoor checks the groups on the server. It sends no code or magic link to the other users, and refuses their sign-in with a code with the error Signing in with a verification code or a magic link is not enabled for your account. Leave Code signin groups empty to let every user sign in with a code or a magic link.
Hide password sign-in
The Hide password rule of Password removes password sign-in from the sign-in page and turns it off on the server. /api/login then rejects every request that signs in with a password, whatever signinMethod the client sends. The only exception is LDAP sign-in, when the application has the LDAP method.
Use it when users sign in only with providers, codes, or other methods, and a password must not work even through the API. Applications saved with the older value Hide-Password behave the same.
Sign in with a magic link
With the Magic link method, the user enters an email address and Casdoor sends a one-time sign-in link to it. Opening the link signs the user in.
Set up the magic link
- Add an Email provider to the Providers of the application, with the rule
Magic linkorAll. See Provider rules. - Set
origin(ororiginFrontend) inconf/app.confto the public URL of Casdoor. Without it, Casdoor refuses to send links with the errorplease set "origin" in conf/app.conf to send magic links, unless the request comes to a loopback host such aslocalhost. See Configuration. - Add Magic link to Signin methods and select a rule.
- Save the application.
How the user signs in
- On the sign-in page, the user selects the magic link method, enters an email address, and clicks Send sign-in link.
- The user opens the link in the email. The link goes back to the sign-in page the user started from, so an OAuth 2.0 or CAS sign-in continues after the link.
- Casdoor signs the user in and marks the email address of the user as verified. If the organization requires multi-factor authentication (MFA), the user completes it next.
Limits
- A link works once, and only in the browser that asked for it.
- A link expires after
verificationCodeTimeoutminutes, 10 by default. See Configuration. - A new link for the same email address or from the same IP address can be sent after the Code resend timeout of the application, 60 seconds by default.
- Forbidden and deleted users can't sign in with a link.
Sign up with a magic link
With the rule Sign in only, a link sent to an unknown email address fails with "the user does not exist, please sign up first". With the rule Sign in or sign up, the link creates the account. This also needs:
- Enable signup on, and Disable self signup off.
- No required sign-up item other than ID, Username, Display name, Email, Password, Confirm password, Agreement, Invitation code, Signup button, and Providers. Otherwise, Casdoor refuses with "The signup item:
<item>is required, so the magic link cannot sign up a new user". - An invitation code, if the application requires one.
The new user gets the email address as the display name. If the organization has Use Email as username on, the email address is also the username.
Email content
Casdoor uses the Content of the Email provider if it contains %link, and a built-in template otherwise. The content can use these placeholders:
| Placeholder | Value |
|---|---|
%link | The sign-in link |
%expireTime | Minutes until the link expires |
%{user.friendlyName} | The name of the user, or Hi for a new user |
The subject is the Title of the provider, or Magic Link if the title is empty.