mdn / mdn/content

FedCM docs don't document active mode properly

Open
#42,136 4 comments 0 reactions 0 assignees View on GitHub
Content:WebAPI help wanted
Dominant language
Markdown
Stars
11k
Forks
23.2k
Avg merge
2d 9h
Merged PRs (30d)
331

Description

So I might be confused here, but.

In FedCM, if an RP calls `navigator.credentials.get()`, and the user is not logged into the IdP, is the user given the opportunity to sign into the IdP, or does `get()` just fail?

It looks to me like the user does get the chance to log in, if the `navigator.credentials.get()` call has `mode` set to `"active"` (and certain other constraints are met). From the spec (https://w3c-fedid.github.io/FedCM/#create-identity-credential, step 7.6):

> If loginStatus is logged-out:
> - If mode is active and mediation is not "silent":
> - Let result be the result of running fetch the config file and show an IDP login dialog with provider and globalObject.
> - If result is failure, return (failure, true).
> - Otherwise, set loginStatus to logged-in.
> - Otherwise, set providerMap[providerOrigin] to "logged-out" and continue.

This also seems to be addressing e.g. https://github.com/w3c-fedid/active-mode/issues/2, which sounds like my use case. But the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/FedCM_API/RP_sign-in#calling_the_get_method), although they describe mode, don't discuss this possibility:

> If the user has never signed into an IdP or is logged out, the get() method rejects with an error and the RP can direct the user to an IdP page to sign in or create an account.

In fact from the [documentation for active mode](https://developer.mozilla.org/en-US/docs/Web/API/FedCM_API/RP_sign-in#active_versus_passive_mode), it's not obvious what the point in setting `mode` to `"active"` is.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.