Skip to content

RP drop-in loader ​

Add a 1pass login button with one script and a <logi-signin> tag. The loader handles markup, styling, and state transitions; it does not handle authentication itself.

Is this the right page?

  • ✅ Yes: A web RP with a backend that wants to add the login button with a script instead of building it by hand
  • ❌ For an SPA (no backend), use the @logi-auth/browser npm package. See the web integration track.
  • ❌ If you only need static markup (styling it yourself without the loader script), see login button components.

Installation ​

html
<script src="https://api.1pass.dev/rp/v1.js" data-client="logi_xxx" defer></script>
<logi-signin login-url="/auth/1pass/start">
  <a href="/auth/1pass/start">1pass 로 계속하기</a>
</logi-signin>

The <a> inside <logi-signin> is a slot fallback. Before the script loads, or if it fails to load, it works as a normal link to login-url. Once the loader loads successfully, it replaces this markup with a branded button.

How it works ​

The loader handles only UI and navigation. The RP backend behind login-url is responsible for generating state, PKCE, and exchanging the code — tokens do not remain in the browser. This structure follows the BFF (Backend-for-Frontend) pattern recommended by the IETF OAuth for Browser-Based Apps BCP.

For server-side callback handling, token exchange, and session issuance, follow the existing web integration track guide. The loader only replaces the button in front of that flow.

Attributes ​

AttributeValueDefaultDescription
login-urlURL (required)—The RP's own login start route to navigate to on click
variantfilled / outlinefilledButton background style
shaperounded / pillroundedCorner radius (14px / 999px)
sizemd / lglgButton height (36px / 48px)
themeauto / light / darkautoauto follows prefers-color-scheme
return-toURL—Path to return to after login. Interpreted by the RP backend
wideboolean—Expand the button to 100% of the parent width
customboolean—Custom button mode. Uses the inner markup as-is; the loader only adds click handling and state. Without this attribute, the inner markup is used only as a fallback when the script is not loaded and is replaced by the branded button

Fixed items — cannot be changed

The following are brand guidelines and cannot be changed through attributes.

  • Wording: 1pass 로 계속하기
  • Mark color: filled = solid white, outline = original gradient
  • Mark size: 22px

Prerequisite — register the origin ​

In the developer console, register your site's exact origin (scheme + host + port) in the app's allowed origins. For an unregistered origin, the loader receives 403 origin_not_allowed and disables itself — the button renders dimmed, clicks are blocked, and the cause code is logged to the console.

  • This is an exact match, not a prefix match. https://app.example.com and https://app.example.com:8443 are different origins.
  • Local development origins (such as http://localhost:3000) must also be registered separately.
  • Where to register: App registration guide

CSP ​

This is the minimum CSP that allows the loader script and configuration requests.

Content-Security-Policy: script-src https://api.1pass.dev; connect-src https://api.1pass.dev

Do not add SRI to the alias URL

/rp/v1.js is a major version alias whose contents are continually updated. Adding an integrity attribute would cause a hash mismatch and prevent legitimate updates from loading. Breaking changes are released under a new path such as /rp/v2.js, so you can trust the alias as-is without SRI.

States and events ​

The loader reflects its current state in the data-state attribute on the <logi-signin> element.

StateMeaning
unknownBefore the script loads (slot fallback is displayed)
loadingFetching configuration
readyRendering completed successfully
errorOrigin not registered or client not approved — button disabled
degradedConfiguration fetch failed (network, timeout, or 5xx) — button remains enabled; the server makes the final authentication decision

The logi:ready / logi:error CustomEvents are fired on document. Their detail contains only clientId (ready) or code and recoverable (error), with no tokens or user information.

js
document.addEventListener('logi:error', (e) => {
  if (!e.detail.recoverable) console.warn('1pass 로더 비활성화:', e.detail.code);
});

A load failure is not a logout

Even if the connection to api.1pass.dev fails, the button continues to work as a slot fallback link (soft failure). Do not mistake this state for a user logout or session expiration — the RP backend cookie is the sole source of truth for the RP's actual session state.

Version policy ​

/rp/v1.js is a major version alias. Minor and patch updates are applied silently at the same path, and a new path such as /rp/v2.js is introduced only for breaking changes. Keep using the alias to receive improvements without a separate migration.

Identity가 제품의 신뢰를 만듭니다.