The short answer
Most apps combine two or three sign-in methods rather than picking one. Consumer apps usually start with social sign-in plus an email code or magic link, and add passkeys as the stronger, lower-friction option; business products add single sign-on through SAML or OpenID Connect when larger customers ask for it. Whatever you choose, store passwords with a slow password hash, check them against breached lists, offer multi-factor authentication, and design account recovery as carefully as sign-in, because it is the easiest way in for an attacker.
Key points
- Pick sign-in methods for your users: consumers want speed, business buyers want single sign-on and control.
- If you keep passwords, follow NIST: long passwords allowed, no forced composition rules or scheduled changes, and a check against breached and common passwords.
- An iOS app that offers third-party social login for the main account must also offer an equivalent privacy-focused option, which is why many add Sign in with Apple.
- Passkeys resist phishing and remove the password entirely. Offer them alongside a fallback.
- Require multi-factor authentication for admins, and treat SMS codes as the weakest second factor.
- Account recovery is part of security. A weak reset flow undoes a strong sign-in.
The sign-in options at a glance
Authentication answers one question: is this person who they claim to be? What they are then allowed to do is authorization, a separate design problem covered in What is RBAC?. The choice of sign-in method shapes your sign-up rate, your support load and your security, so it is worth deciding on purpose rather than by default.
| Method | User friction | Security | Effort to build well |
|---|---|---|---|
| Email and password | Medium: one more password to remember | Depends on storage, breach checks and MFA | Medium: hashing, resets, rate limits, breach checks |
| Magic link or email code | Low to medium: a trip to the inbox each time | As strong as the user’s email account | Low to medium: tokens, expiry, email delivery |
| SMS code | Low, but codes can be delayed | Weaker: open to SIM swaps and phishing | Medium: a messaging provider and fraud controls |
| Social sign-in | Low: one tap with an existing account | Good, inherits the provider’s protections | Low to medium per provider, plus account linking |
| Passkeys | Low once set up: a fingerprint, face or PIN | High: resistant to phishing | Medium: new flows and a fallback for older devices |
| Enterprise SSO (SAML or OIDC) | Very low for employees of the customer | High, controlled by the customer’s identity provider | Medium to high: per-customer setup and testing |
Multi-factor authentication is not on the list because it is a layer on top of any of these, not an alternative to them.
Email and password, done properly
Passwords are familiar and work everywhere, which is why most apps still offer them. They are also the method that is easiest to get wrong. The US National Institute of Standards and Technology publishes SP 800-63B, the guideline many teams in and outside the US use as a reference, and its current version changed several old habits.
- Length over complexity: at least 15 characters when the password is the only factor, at least 8 when it is used with another factor, and support for at least 64.
- No composition rules, such as requiring a digit and a symbol. NIST now prohibits them.
- No forced changes on a schedule. Require a change only when there is evidence the password was compromised.
- Check every new or changed password against a blocklist of common, expected and breached passwords, and tell the user why a password was rejected.
- Allow password managers, autofill and pasting, and offer a way to show the password while typing.
- Limit failed attempts, so an attacker cannot guess at speed.
- No password hints or security questions at sign-up.
Storage matters as much as the rules. NIST requires passwords to be salted and hashed with a scheme designed for passwords. The OWASP Password Storage Cheat Sheet recommends Argon2id first, then scrypt, bcrypt for older systems, and PBKDF2 where FIPS-140 compliance is required. Fast general-purpose hashes such as SHA-256 are not suitable, and passwords should never be stored encrypted or in plain text. Most frameworks and auth libraries ship a sound default; the mistake to avoid is writing your own.
Magic links and one-time codes
A magic link is a sign-in link sent by email; a one-time code is a short code sent by email or text message. Both remove the password, so there is nothing to forget or reuse, and sign-up can be a single field. They suit apps people open occasionally, where a forgotten password would otherwise mean a reset every time.
- The account is only as safe as the inbox or phone number behind it.
- Email can be slow or land in spam, and a link opened on a different device from the one signing in confuses people. Offering a code as well as a link helps.
- Tokens must be random, single use and short-lived, the same rules OWASP gives for password reset tokens.
- Codes typed by hand are not phishing resistant: a fake site can ask for the code and relay it. NIST says the same of passwords and other one-time codes.
- NIST goes further for email: SP 800-63B says email must not be used for out-of-band authentication, because an inbox may be protected by only a password and messages can be intercepted or rerouted. Many consumer apps use email sign-in anyway; for accounts that hold money, health data or admin rights, pair it with a stronger factor.
Text message codes deserve extra caution. NIST classifies sign-in codes sent by SMS or voice call as a restricted method, and OWASP notes they are exposed to SIM swapping, where an attacker persuades a carrier to move the victim’s number. They are better than no second factor, but they should not be the only option for valuable accounts.
Passkeys
A passkey is a credential based on FIDO standards that lets people sign in by unlocking their device with a fingerprint, face scan or PIN. The device proves who the user is with public-key cryptography, so there is no shared secret for a fake site to capture. Passkeys can sync across a person’s devices through a passkey provider or stay on one device, such as a hardware security key.
Passkeys are the strongest option most apps can offer without extra hardware. NIST SP 800-63B lists WebAuthn-based authenticators among the phishing-resistant methods and requires services at its middle assurance level to offer at least one phishing-resistant option. The practical approach is to offer passkey creation after a user signs in another way, keep a fallback for devices and people that are not ready, and make recovery work when a device is lost. See What are passkeys? for the user experience in detail.
Single sign-on for business customers
If you sell software to companies, larger customers will eventually ask for single sign-on: their employees sign in through the company’s identity provider, and when someone leaves, IT removes access in one place. Two standards cover most requests. SAML is the long-established enterprise federation standard. OpenID Connect is an authentication protocol built on the OAuth 2.0 framework. Most identity providers your customers use can speak at least one of them.
- Start with email sign-in plus Google and Microsoft buttons. Many small business customers already use one of the two.
- Add SAML and OpenID Connect SSO per customer organization when the first larger customer requires it, with a setup screen their IT admin can complete.
- Route users to SSO by email domain, and stop people at that company from signing in with a password once SSO is on, or the control is easy to bypass.
- Plan for automatic user provisioning and removal from the customer’s directory, which often comes next in the same conversation.
- Map groups from the identity provider to roles in your app, and keep authorization checks on your server.
SSO is often sold as a feature of higher plans, which is a business decision. The engineering point is to design tenants and roles so that adding it later does not require rebuilding sign-in.
Multi-factor authentication, sessions and account recovery
Multi-factor authentication asks for a second proof after the first. The OWASP Multifactor Authentication Cheat Sheet recommends requiring it for administrators and other high-privilege users, and when a normal session is raised to an administrative one. Second factors differ in strength.
| Second factor | Strength | Notes |
|---|---|---|
| Passkey or hardware security key | Strongest | Phishing resistant |
| Authenticator app code | Good | Standards-based and widely installed, but a fake site can still relay the code |
| Email code | Moderate | Only as safe as the inbox, and not accepted by NIST as an out-of-band factor |
| SMS or voice code | Weakest | Restricted by NIST, exposed to SIM swapping |
Give users single-use recovery codes when they turn MFA on, let them enroll more than one factor, and require an existing factor, not just a signed-in session, before anyone can change them.
Once a user is in, the session keeps them in. The OWASP Session Management Cheat Sheet sets out the basics: session cookies marked Secure, HttpOnly and SameSite; a new session identifier after sign-in, password changes and role changes; both an idle timeout and an absolute limit, enforced on the server; and sign-out that ends the session on the server, not just in the browser.
Recovery is the path attackers try first, because it is built to let someone in without their credentials. OWASP’s guidance for forgotten passwords: show the same message whether or not an account exists, send random, single-use reset tokens that expire, change nothing on the account until the token is used, rate-limit requests, notify the user after a reset, and do not rely on security questions alone.
A managed auth provider or your own
You do not have to build all of this. There are three broad routes: a managed authentication service that hosts sign-in for you, an open-source identity server you run yourself, or the auth library that comes with your web framework.
| Route | Good for | Watch for |
|---|---|---|
| Managed auth service | Fast start, social login, MFA, passkeys and enterprise SSO without building each one | Pricing that grows with active users or SSO connections, limits on customizing screens, and how you would export users and password hashes if you leave |
| Self-hosted open-source identity server | Control over data location, no per-user fees | You run, patch and monitor it, and an outage locks everyone out |
| Framework auth library | Simple email and social sign-in inside one app | MFA, SSO and passkeys may be add-ons or missing, and security fixes are yours to apply |
Whichever route you take, some things stay with you: deciding what each role can do, checking it on every request, keeping users mapped to the right customer in a multi-tenant product, and logging sign-ins and permission changes. A provider handles the front door; the rest of the house is still yours.
If you are planning sign-in for a new product or replacing an old one, web app development describes how we approach the build: the code lives in your GitHub from day one, and the founders are on the calls.
Sources
Checked when this guide was written.
- NIST Special Publication 800-63B
- OWASP: Password Storage Cheat Sheet
- OWASP: Multifactor Authentication Cheat Sheet
- OWASP: Session Management Cheat Sheet
- OWASP: Forgot Password Cheat Sheet
- Apple Developer: App Review Guidelines
- FIDO Alliance: FIDO Passkeys: Passwordless Authentication
- OpenID Foundation: How OpenID Connect Works
Social sign-in, and the App Store rule
Signing in with an existing Google, Apple, Microsoft or other account is the lowest-friction option for most consumers, and the provider handles the password, the second factor and suspicious sign-in checks. Under the hood these buttons use OAuth 2.0 and OpenID Connect; OAuth 2.0 and OpenID Connect explained covers the flows for developers.
If you ship an iOS app, Apple’s App Review Guideline 4.8 applies. When an app uses a third-party or social login service to set up or authenticate the user’s primary account, it must also offer, as an equivalent option, a login service that limits data collection to name and email, lets users keep their email address private, and does not collect app interactions for advertising without consent. Sign in with Apple meets those conditions, which is why most apps with social buttons on iOS include it. The guideline lists exceptions, including apps that use only their own account system, education and enterprise apps that require an existing organization account, apps using a government-backed electronic ID, and clients for a specific third-party service.