navigator.login is the entry point for the Login Status API used by federated identity providers. Learn NavigatorLogin.setStatus, FedCM context, secure context rules, five examples, and try-it labs.
01
Kind
Read-only property
02
Returns
NavigatorLogin
03
API
Login Status
04
Context
Secure (HTTPS)
05
Method
setStatus()
06
Values
logged-in / out
Fundamentals
Introduction
Federated sign-in (“Sign in with …”) involves an identity provider (IdP) and a relying party (RP) website. The browser’s FedCM flow needs to know whether anyone is actually signed into the IdP before asking for accounts.
navigator.login returns a NavigatorLogin object. On the IdP’s own site, after login or logout, you call setStatus("logged-in") or setStatus("logged-out") so the browser can store that IdP login status.
💡
IdP API, not your app’s session
This does not replace cookies or tokens for your own website login. It tells the browser about the IdP’s signed-in state for FedCM. Regular apps keep using their normal auth stack (and often navigator.credentials).
Concept
Understanding the login Property
Think of navigator.login as a signal light the IdP flips for the browser: “someone is logged in here” vs “everyone is logged out.”
NavigatorLogin — object returned by navigator.login.
setStatus(status) — IdP reports login status to the browser.
"logged-in" — at least one IdP account is signed in.
"logged-out" — all IdP accounts are signed out.
FedCM — uses the signal to avoid useless account requests.
A NavigatorLogin object when the Login Status API is available.
Common patterns
JavaScript
// MDN examples — call from the IdP origin after auth changes:
navigator.login.setStatus("logged-in");
navigator.login.setStatus("logged-out");
// Safe feature-detect + await:
if (navigator.login && typeof navigator.login.setStatus === "function") {
await navigator.login.setStatus("logged-in");
}
Cheat Sheet
⚡ Quick Reference
Goal
Code
Get Login Status API
navigator.login
Detect API
Boolean(navigator.login)
Signal signed in
await navigator.login.setStatus("logged-in")
Signal signed out
await navigator.login.setStatus("logged-out")
Secure page?
window.isSecureContext
Related
FedCM / IdP integration
Snapshot
🔍 At a Glance
Four facts to remember about navigator.login.
Returns
NavigatorLogin
IdP helper
Method
setStatus()
Promise
HTTPS
required
Secure context
Audience
IdP sites
FedCM
Compare
📋 login vs credentials
navigator.login
navigator.credentials
Purpose
Tell browser IdP login status
Get/store user credentials
Typical caller
Identity provider (IdP)
Any site with a sign-in form
Key method
setStatus()
get() / store()
FedCM role
Login Status signal
Separate credential flows
Replaces your session?
No
No — still need server auth
Hands-On
Examples Gallery
Examples follow MDN Login Status / navigator.login.setStatus patterns. Prefer Try It Yourself on HTTPS. Real FedCM value appears when called from an IdP origin after login/logout.
📚 Getting Started
Detect the API and confirm a secure context.
Example 1 — Feature Detection
Check whether the Login Status entry point exists.
JavaScript
const supported = Boolean(navigator.login);
console.log(supported ? "Login Status API available" : "Login Status API missing");
Login Status API missing
(or "Login Status API available" in a supporting browser)
How It Works
Safari typically omits this API today — always keep a non-FedCM path.
Example 2 — Secure Context Check
Login Status requires HTTPS / localhost.
JavaScript
console.log("secure: " + window.isSecureContext);
console.log("login: " + Boolean(navigator.login));
if (!window.isSecureContext) {
console.log("Serve over HTTPS to use navigator.login");
} else if (!navigator.login) {
console.log("Secure, but Login Status API not exposed");
} else {
console.log("Ready to call setStatus");
}
navigator.login (Login Status API) requires a secure context and is not universal. Chromium and Firefox have shipped support; Safari typically has not. Always feature-detect.
✓ Limited · Secure context
Navigator.login
IdP sites call setStatus after login/logout so FedCM knows whether accounts may exist.
LimitedNot universal
Google ChromeLogin Status / navigator.login since ~120 (secure context)
Supported
Microsoft EdgeChromium Edge — follows Chrome Login Status support
Supported
OperaChromium-based — Login Status where Chromium enables it
Supported
Mozilla Firefoxnavigator.login since ~138 — verify on target versions
Supported*
Apple SafariTypically unavailable — check current MDN
Unavailable
loginLimited
Bottom line: Detect navigator.login over HTTPS. Call setStatus only from the IdP origin after real auth changes.
Wrap Up
Conclusion
navigator.login is the Login Status API entry point for identity providers. Feature-detect it in a secure context, call setStatus("logged-in") or "logged-out" from the IdP origin after auth changes, and keep FedCM as an enhancement — not your only auth path.
IdP Login Status signal for FedCM — setStatus after auth changes.
5
Core concepts
🔑01
Returns
NavigatorLogin
Entry
👤02
Caller
IdP origin
FedCM
🔒03
Method
setStatus
Signal
🔓04
Values
in / out
Status
🔬05
Support
Limited
Detect
❓ Frequently Asked Questions
It is a read-only Navigator property that returns a NavigatorLogin object so a federated identity provider (IdP) can tell the browser whether users are logged into the IdP.
MDN/BCD does not mark it Deprecated, Experimental, or Non-standard. Support is still limited (notably missing in Safari). Always feature-detect and require a secure context.
The IdP site — after a user signs in or out on the IdP’s own origin. Relying parties (websites that use “Sign in with …”) do not use this to log users into their own app.
"logged-in" means at least one user account is signed in at the IdP. "logged-out" means all IdP accounts are signed out.
So the browser can skip useless account requests when nobody is logged into the IdP, and to help mitigate timing attacks related to federated sign-in.
Yes. It is available only in secure contexts (HTTPS or localhost). setStatus also requires same-origin framing rules when used inside iframes.
Did you know?
MDN’s wording for login status is carefully narrow: it means whether any users are logged into the IdP in this browser — not which account, and not whether the relying party website has a session.