What the storefront adds around your Site
A signed-in member sees the Passport and never the lead-capture button. A guest sees the lead-capture button and never the Passport. When the visitor signs in or out, the two swap in place.
The Passport
The Passport is the storefront’s account menu. On a Site it does three jobs for you:- It’s the visitor’s account. The member’s account, such as their orders and subscriptions, opens from it, so your Site doesn’t build any of them.
- It lists the member’s Sites. Its sites menu lists the Sites the member can open, including any your company pinned for them. See Show a Site to members.
- It holds the sign-out. A Site can’t sign anyone out. The visitor signs out in the Passport, and confirms it there.
Sign-in carries over from the storefront
A member who is signed in on your storefront is already signed in on every Site there. There’s no second login and no sign-in screen of your own to build.fluid.auth.me() gives your Site the visitor’s name, avatar, user and member ids, their relation to the Site (owner, admin or member), and only the member fields your Site declares in config/access.json. See Read who is here and Fluid data the site uses.
How it stays secure
Your Site’s code runs on its own host undersites.fluid.app, in a sandboxed frame on the storefront’s page. Because that host is a different origin from your storefront:
- Your Site never receives the visitor’s Fluid credentials. It can’t read the storefront’s sign-in cookie or any Fluid token, and neither can a script you add to your Site.
- The storefront hands your Site a short-lived session. It’s scoped to that one Site and that visitor, and the SDK renews it while the page is open. The SDK sends it only to your Site’s own host.
- Every call acts as the visitor.
fluid.apiandctx.fluid.apireach only that visitor’s own data, within the scopes your Site declares. A guest’s call goes as a guest. - A private Site’s files stay private. Its pages, scripts and functions aren’t served to someone the Site doesn’t admit, even when they open its host directly.
- Sign-in takes a click.
fluid.auth.signIn()sends the visitor to the storefront’s own sign-in only from a click, so a Site can’t redirect visitors to it on load.
Hide the floating cart and lead-capture buttons
To hide FairShare’s floating cart and lead-capture buttons, such as when your Site draws its own controls in that corner, addconfig/shell.json to your Site and publish it:
config/shell.json
fluid.cart, the cart drawer, checkout and the visit’s credit keep working, so give visitors your own cart button with fluid.cart.open() and guests your own sign-in with fluid.auth.signIn(). Publish the file with Sites plugin 0.1.379 or later. See The storefront around the Site.
"fairshare": "hidden" doesn’t hide the Passport. A signed-in member always sees the Passport’s button, because it holds their sign-out. A guest never sees it.Open the Passport from your own button
To open the Passport from a button of your own, such as an avatar in your Site’s header, callfluid.auth.signOut() from the click:
signOut()signs nobody out. It opens the Passport, where the visitor can sign out and confirm it.- It needs a signed-in visitor. A guest has no Passport, so the call does nothing for a guest. Send a guest to
fluid.auth.signIn()instead, as above. - It needs the storefront. Outside a storefront, such as on the Site’s own host, it does nothing and logs a warning.
What the storefront loads, and what it costs your Site
The storefront page around your Site loads the Passport, FairShare (the cart, lead capture and the visit’s credit) and a small script that connects your Site to them. Each one loads as a deferred module script, so none of them blocks the page. Scripts your company adds to the storefront for Sites load as the company wrote them.- Your Site paints on its own. It loads in its own frame, in parallel with the storefront’s scripts. If the storefront’s scripts are slow or fail, your Site still opens and works. Only the parts they draw, such as the Passport and the cart, are missing.
- The SDK is yours to load. The storefront doesn’t add anything to your Site’s own pages. Import
@fluid-app/sitesin your build, or load/_fluid/sdk/v1/sites.jsfrom your Site’s own host as the plain HTML guide shows. Load it as a module, so it never blocks your first paint. - A call waits for the sign-in, briefly. A call made before the SDK has connected to the storefront waits for it, for up to three seconds, then goes as a guest.