@wix/origami-auth
v1.1.1
Published
Visitor auth for Origami sites: starts @wix/builder-auth, registers the global Wix SDK client, and hands the visitor token to component bundles
Maintainers
Keywords
Readme
Origami auth
Visitor auth for Origami sites, on top of @wix/builder-auth.
- On import, in the browser, it publishes builder-auth's
window.wixEmbedsAPIgetters and registers the global@wix/sdkclient, both overgetVisitorAccessToken. A bundle built with an older@wix/sitereadswindow.wixEmbedsAPIonce, when it is imported, so the site's entry imports this package before anything else. initVisitorAuth({ clientId, siteId }): the site's generated entry calls it withVITE_WIX_CLIENT_IDandVITE_WIX_METASITE_IDbefore it mounts the page. It starts theAuthManagerand resolves when the first token is there. It never rejects: without a site identity or a first token the page still renders.injectVisitorAccessToken(module): hands a component bundle'sinjectAccessTokenGetterthe visitor's token getter when its generated wrapper is imported. Browser only; does nothing on the server or if the bundle has no injector.getVisitorAccessToken(): the getter passed to a bundle'sinjectAccessTokenGetter. It waits until auth starts, then asks the manager for a current token on every call. Without a site identity it rejects.
A site must have one copy of this package: a second copy would wait for a start that never comes. Wrapper packages take it as a peer dependency for that reason.
Before local builds or tests, run pnpm -r run build from the repository root to build workspace dependencies in order.
