JavaScript
安装
yarn add @passwordlessdev/passwordless-clientimport { Client } from '@passwordlessdev/passwordless-client';
const p = new Client({ apiKey: "" })npm install @passwordlessdev/passwordless-clientimport { Client } from '@passwordlessdev/passwordless-client';
const p = new Client({ apiKey: "" })<script type="module">
import { Client } from "https://cdn.passwordless.dev/dist/1.1.0/esm/passwordless.min.mjs"
const p = new Client({ apiKey: "" })
</script><script src="https://cdn.passwordless.dev/dist/1.1.0/umd/passwordless.umd.min.js" crossorigin="anonymous"></script><script>
const Client = Passwordless.Client;
const p = new Client({});
</script>.register()
// 使用您的 API 公钥实例化无密码客户端。
const p = new Passwordless.Client({
apiKey: "myapplication:public:4364b1a49a404b38b843fe3697b803c8"
});
// 从后端获取注册令牌。
const backendUrl = "https://localhost:8002";
const registerToken = await fetch(backendUrl + "/create-token?userId" + userId).then(r => r.json());
// 在最终用户的设备上注册令牌。
const { token, error } = await p.register(registerToken);.signinWith()
方法
描述
示例
响应
.isBrowserSupported()
.isPlatformSupported()
.isAutofillSupported()
最后更新于