identity.login()
在可信用户操作中打开平台登录流程。guest 不传 provider、return URL 或自由字符串,也不接收 token。
Syntax
await host.identity.login();
Return value
无。流程结束后重新调用 status()。
Examples
loginButton.onclick = async () => {
await host.identity.login();
const state = await host.identity.status();
renderAccountControls(state.authenticated);
};
Errors
activation-required、denied、flow-expired、platform-unavailable。用户关闭可信 UI 是正常取消。
Security
回跳使用壳层单次 nonce 或固定位置;不能把 guest 路由、查询串或整个 location 编码进登录 URL。