@comms-id/sign-in-react

中文文档
0.1.0发布于 2026/10/21SEE LICENSE IN LICENSETypeScriptES Module

React hook and button for Sign in with Comms.ID: a link to your app's own sign-in route, rendered on the server too

此软件包已被标记为弃用

Removed. Comms.ID products are served live, nothing to install: https://islands.relyingparty.app/authenticate/embed.js

原始使用文档

@comms-id/sign-in-react

The Sign in with Comms.ID button for React: a link to your app's own sign-in route. Your server runs the sign-in with @comms-id/sign-in/flow; the button holds no key and calls nothing.

import { SignInButton } from "@comms-id/sign-in-react";

<SignInButton start="/auth/sign-in" signInClass="team" returnTo="/account" />;
// <a href="/auth/sign-in?class=team&return_to=%2Faccount">Sign in with Comms.ID</a>
  • start: your start route, a path or an https URL on the page's own origin (/auth/sign-in by default). Anything that could leave your origin is refused, and the button links nowhere (onInvalid, console.error by default).
  • signInClass: person (the default) or team. returnTo: a path of your app. label: the text.
  • It renders the link on the server too, starts once (a second press does nothing), and is ready again on a page restored from the back-forward cache.
  • useSignIn(options) gives state and getButtonProps() for your own markup.
  • Style it with the --comms-id-* variables or the comms-id-sign-in class.

版本与发布记录

@comms-id/sign-in-react 共发布 2 个版本,首次发布于 2026/10/21;过去 12 个月发布了 2 个版本。

版本发布日期距今
0.1.0latest2026/10/2113 天前
0.0.0-stage2026/10/2113 天前

关于 @comms-id/sign-in-react 的常见问题

@comms-id/sign-in-react 是什么?

React钩子和按钮Sign in with Comms。ID:链接到你的应用自己的登录路由,也呈现在服务器上注意:该包已被作者标记为弃用——Removed. Comms.ID products are served live, nothing to install: https://islands.relyingparty.app/authenticate/embed.js

如何安装 @comms-id/sign-in-react?

在项目目录运行 npm install @comms-id/sign-in-react,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@comms-id/sign-in-react 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@comms-id/sign-in-react 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@comms-id/sign-in-react 可以商用吗?

@comms-id/sign-in-react 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@comms-id/sign-in-react 还在维护吗?

最新版本 0.1.0 发布于 2026/10/21(13 天前);至今共发布 2 个版本,其中过去 12 个月发布了 2 个;首次发布于 2026/10/21。作者已将其标记为弃用,新项目建议寻找替代方案。