v0.1首个正式支持的版本化规范查看版本范围

identity.login() 非正式提议

本页不是正式 API 规范;它记录待可信 UI 与 appId 绑定单次 nonce 验证的候选契约。

在可信用户操作中打开平台登录流程。guest 不传 provider、return URL 或自由字符串,也不接收 token。

Syntax

const result = await host.identity.login(options?);

Parameters

options?: CallOptions:可选取消信号;guest 不得传 provider、return URL 或其他业务载荷。

Return value

{ authenticated: true } | null。调用线性化时本 appId 已登录则直接返回前者而不打开 UI;否则登录完成返回前者,用户关闭可信 UI 返回 null。取消信号以 cancelled 失败,不与用户取消混用。

Examples

loginButton.onclick = async () => {
  const result = await host.identity.login();
  if (result) renderAccountControls(result.authenticated);
};

Errors

activation-requireddeniedflow-expiredplatform-unavailable。用户关闭可信 UI 是正常取消。

取消与应用会话提交必须线性排序:取消先发生则以 cancelled 失败且不得建立应用会话;提交先发生则返回 { authenticated: true },后到的取消不改变结果。

Security

回跳使用壳层单次 nonce 或固定位置;不能把 guest 路由、查询串或整个 location 编码进登录 URL。

Requirements

  • 能力:host:identity.login
  • 可信用户激活:必须;仅改变状态时打开平台 UI
  • 可取消:是;取消不返回部分身份状态
  • 信任档位:green

See also

identity.status()identity

Host API 版本与分层概览Host API v0.1版本非正式提议提议canvas API呈现canvas.getInfo()方法canvas.draw()方法canvas.present()方法canvas.measureText()方法canvas.frame event事件canvas.resize event事件asset API呈现asset.read()方法asset.loadFont()方法playback API呈现playback.open()方法playback.write()方法playback.stop()方法playback.ready event事件playback.ended event事件input API输入input.focus()方法input.pointer event事件input.key event事件input.wheel event事件input.focusChange event事件ime API输入ime.openSession()方法ime.updateState()方法ime.updateGeometry()方法ime.closeSession()方法ime.textUpdate event事件ime.composition event事件ime.formatUpdate event事件ime.characterBoundsRequest event事件ime.ended event事件capture API输入capture.requestCamera()方法capture.requestMic()方法capture.frame()方法capture.readAudio()方法capture.stop()方法capture.ended event事件store API数据store.get()方法store.put()方法store.delete()方法store.list()方法store.deletePrefix()方法clipboard API数据clipboard.readText()方法clipboard.writeText()方法env API平台集成env.snapshot()方法env.change event事件开始调用 Host API指南构建交互式绘图应用指南构建自绘文本编辑器指南管理媒体采集与播放指南组织本地数据与同步指南