已开启
fix docs #2
j21p3创建于 3月6日
fix docs #2
已开启
共 1 个文件变更+56-16
| @@ -2576,18 +2576,12 @@ ArkTS-Sta示例: | |||
| 2576 | 2576 | ||
| 2577 | ### auth<sup>9+</sup> | 2577 | ### auth<sup>9+</sup> |
| 2578 | 2578 | ||
| 2579 | -ArkTS-Dyn: auth(name: string, owner: string, authType: string, options: Record<string, Object>, callback: AuthCallback): void | 2579 | +auth(name: string, owner: string, authType: string, options: Record<string, Object>, callback: AuthCallback): void |
| 2580 | - | ||
| 2581 | -ArkTS-Sta: auth(name: string, owner: string, authType: string, options: Record<string, RecordData>, callback: AuthCallback): void | ||
| 2582 | 2580 | ||
| 2583 | 对应用账号进行鉴权以获取授权令牌。使用callback异步回调。 | 2581 | 对应用账号进行鉴权以获取授权令牌。使用callback异步回调。 |
| 2584 | 2582 | ||
| 2585 | **系统能力:** SystemCapability.Account.AppAccount | 2583 | **系统能力:** SystemCapability.Account.AppAccount |
| 2586 | 2584 | ||
| 2587 | -**ArkTS-Dyn起始版本:** 9 | ||
| 2588 | - | ||
| 2589 | -**ArkTS-Sta起始版本:** 23 | ||
| 2590 | - | ||
| 2591 | **参数:** | 2585 | **参数:** |
| 2592 | 2586 | ||
| 2593 | | 参数名 | 类型 | 必填 | 说明 | | 2587 | | 参数名 | 类型 | 必填 | 说明 | |
| @@ -2595,7 +2589,7 @@ ArkTS-Sta: auth(name: string, owner: string, authType: string, options: Record<s | |||
| 2595 | | name | string | 是 | 应用账号的名称。 | | 2589 | | name | string | 是 | 应用账号的名称。 | |
| 2596 | | owner | string | 是 | 应用账号所有者的包名。 | | 2590 | | owner | string | 是 | 应用账号所有者的包名。 | |
| 2597 | | authType | string | 是 | 鉴权类型。 | | 2591 | | authType | string | 是 | 鉴权类型。 | |
| 2598 | -| options | ArkTS-Dyn: Record<string, Object><br>ArkTS-Sta: Record<string, RecordData> | 是 | 鉴权所需的可选项。 | | 2592 | +| options | Record<string, Object> | 是 | 鉴权所需的可选项。 | |
| 2599 | | callback | [AuthCallback](#authcallback9) | 是 | 回调对象,返回鉴权结果。 | | 2593 | | callback | [AuthCallback](#authcallback9) | 是 | 回调对象,返回鉴权结果。 | |
| 2600 | 2594 | ||
| 2601 | **错误码:** | 2595 | **错误码:** |
| @@ -2614,7 +2608,6 @@ ArkTS-Sta: auth(name: string, owner: string, authType: string, options: Record<s | |||
| 2614 | 2608 | ||
| 2615 | **示例:** | 2609 | **示例:** |
| 2616 | 2610 | ||
| 2617 | -ArkTS-Dyn示例: | ||
| 2618 | ```ts | 2611 | ```ts |
| 2619 | import { appAccount } from '@kit.BasicServicesKit'; | 2612 | import { appAccount } from '@kit.BasicServicesKit'; |
| 2620 | import { BusinessError } from '@kit.BasicServicesKit'; | 2613 | import { BusinessError } from '@kit.BasicServicesKit'; |
| @@ -2662,7 +2655,39 @@ ArkTS-Dyn示例: | |||
| 2662 | } | 2655 | } |
| 2663 | ``` | 2656 | ``` |
| 2664 | 2657 | ||
| 2665 | -ArkTS-Sta示例: | 2658 | +### auth<sup>23+</sup> |
| 2659 | + | ||
| 2660 | +auth(name: string, owner: string, authType: string, options: Record<string, RecordData>, callback: AuthCallback): void | ||
| 2661 | + | ||
| 2662 | +对应用账号进行鉴权以获取授权令牌。使用callback异步回调。 | ||
| 2663 | + | ||
| 2664 | +**系统能力:** SystemCapability.Account.AppAccount | ||
| 2665 | + | ||
| 2666 | +**参数:** | ||
| 2667 | + | ||
| 2668 | +| 参数名 | 类型 | 必填 | 说明 | | ||
| 2669 | +| -------- | --------------------- | ---- | --------------- | | ||
| 2670 | +| name | string | 是 | 应用账号的名称。 | | ||
| 2671 | +| owner | string | 是 | 应用账号所有者的包名。 | | ||
| 2672 | +| authType | string | 是 | 鉴权类型。 | | ||
| 2673 | +| options | Record<string, RecordData> | 是 | 鉴权所需的可选项。 | | ||
| 2674 | +| callback | [AuthCallback](#authcallback9) | 是 | 回调对象,返回鉴权结果。 | | ||
| 2675 | + | ||
| 2676 | +**错误码:** | ||
| 2677 | + | ||
| 2678 | +以下错误码的详细介绍请参见[账号管理错误码](errorcode-account.md)和[通用错误码](../errorcode-universal.md)。 | ||
| 2679 | + | ||
| 2680 | +| 错误码ID | 错误信息| | ||
| 2681 | +| ------- | -------| | ||
| 2682 | +| 12300001 | System service exception. | | ||
| 2683 | +| 12300002 | Invalid name, owner, authType or options. | | ||
| 2684 | +| 12300003 | Account not found. | | ||
| 2685 | +| 12300010 | Account service busy. | | ||
| 2686 | +| 12300113 | Authenticator service not found. | | ||
| 2687 | +| 12300114 | Authenticator service exception. | | ||
| 2688 | + | ||
| 2689 | +**示例:** | ||
| 2690 | + | ||
| 2666 | ```ts | 2691 | ```ts |
| 2667 | import appAccount from '@ohos.account.appAccount'; | 2692 | import appAccount from '@ohos.account.appAccount'; |
| 2668 | import { BusinessError } from '@kit.BasicServicesKit'; | 2693 | import { BusinessError } from '@kit.BasicServicesKit'; |
| @@ -7245,8 +7270,8 @@ getAuthenticatorInfo(owner: string): Promise<AuthenticatorInfo> | |||
| 7245 | 7270 | ||
| 7246 | | 名称 | 值 | 说明 | | 7271 | | 名称 | 值 | 说明 | |
| 7247 | | -------------------------------- | ---------------------- | ----------------------- | | 7272 | | -------------------------------- | ---------------------- | ----------------------- | |
| 7248 | -| ACTION_ADD_ACCOUNT_IMPLICITLY<sup>(deprecated)</sup> | 'addAccountImplicitly' | 表示操作,隐式添加账号。<br/>**ArkTS模式:** 仅适用于ArkTS-Dyn。 <br/>**ArkTS-Dyn起始版本:** 8| | 7273 | +| ACTION_ADD_ACCOUNT_IMPLICITLY<sup>(deprecated)</sup> | 'addAccountImplicitly' | 表示操作,隐式添加账号。<br>**说明:**从API version 8开始支持,从API version 9开始废弃,建议使用ACTION_CREATE_ACCOUNT_IMPLICITLY替代。 <br/>**ArkTS模式:** 仅适用于ArkTS-Dyn。 <br/>**ArkTS-Dyn起始版本:** 8 | |
| 7249 | -| ACTION_AUTHENTICATE<sup>(deprecated)</sup> | 'authenticate' | 表示操作,鉴权。<br/>**ArkTS模式:** 仅适用于ArkTS-Dyn。<br/>**ArkTS-Dyn起始版本:** 8 | | 7274 | +| ACTION_AUTHENTICATE<sup>(deprecated)</sup> | 'authenticate' | 表示操作,鉴权。<br>**说明:**从API version 8开始支持,从API version 9开始废弃,建议使用ACTION_AUTH替代。<br/>**ArkTS模式:** 仅适用于ArkTS-Dyn。<br/>**ArkTS-Dyn起始版本:** 8 | |
| 7250 | | ACTION_CREATE_ACCOUNT_IMPLICITLY<sup>9+</sup> | 'createAccountImplicitly' | 表示操作,隐式创建账号。<br/>**ArkTS-Dyn起始版本:** 9<br/>**ArkTS-Sta起始版本:** 23 | | 7275 | | ACTION_CREATE_ACCOUNT_IMPLICITLY<sup>9+</sup> | 'createAccountImplicitly' | 表示操作,隐式创建账号。<br/>**ArkTS-Dyn起始版本:** 9<br/>**ArkTS-Sta起始版本:** 23 | |
| 7251 | | ACTION_AUTH<sup>9+</sup> | 'auth' | 表示操作,鉴权。<br/>**ArkTS-Dyn起始版本:** 9<br/>**ArkTS-Sta起始版本:** 23 | | 7276 | | ACTION_AUTH<sup>9+</sup> | 'auth' | 表示操作,鉴权。<br/>**ArkTS-Dyn起始版本:** 9<br/>**ArkTS-Sta起始版本:** 23 | |
| 7252 | | ACTION_VERIFY_CREDENTIAL<sup>9+</sup> | 'verifyCredential' | 表示操作,验证凭据。<br/>**ArkTS-Dyn起始版本:** 9<br/>**ArkTS-Sta起始版本:** 23 | | 7277 | | ACTION_VERIFY_CREDENTIAL<sup>9+</sup> | 'verifyCredential' | 表示操作,验证凭据。<br/>**ArkTS-Dyn起始版本:** 9<br/>**ArkTS-Sta起始版本:** 23 | |
| @@ -7653,9 +7678,7 @@ addAccountImplicitly(authType: string, callerBundleName: string, options: {[key: | |||
| 7653 | 7678 | ||
| 7654 | ### auth<sup>9+</sup> | 7679 | ### auth<sup>9+</sup> |
| 7655 | 7680 | ||
| 7656 | -ArkTS-Dyn: auth(name: string, authType: string, options: Record<string, Object>, callback: AuthCallback): void | 7681 | +auth(name: string, authType: string, options: Record<string, Object>, callback: AuthCallback): void |
| 7657 | - | ||
| 7658 | -ArkTS-Sta: auth(name: string, authType: string, options: Record<string, RecordData>, callback: AuthCallback): void | ||
| 7659 | 7682 | ||
| 7660 | 对应用账号进行鉴权以获取授权令牌。使用callback异步回调。 | 7683 | 对应用账号进行鉴权以获取授权令牌。使用callback异步回调。 |
| 7661 | 7684 | ||
| @@ -7667,7 +7690,24 @@ ArkTS-Sta: auth(name: string, authType: string, options: Record<string, Recor | |||
| 7667 | | ---------------- | --------------------- | ---- | --------------- | | 7690 | | ---------------- | --------------------- | ---- | --------------- | |
| 7668 | | name | string | 是 | 应用账号的名称。 | | 7691 | | name | string | 是 | 应用账号的名称。 | |
| 7669 | | authType | string | 是 | 应用账号的鉴权类型。 | | 7692 | | authType | string | 是 | 应用账号的鉴权类型。 | |
| 7670 | -| options | ArkTS-Dyn: Record<string, Object><br>ArkTS-Sta: Record<string, RecordData>| 是 | 鉴权所需要的可选项。 | | 7693 | +| options | Record<string, Object> | 是 | 鉴权所需要的可选项。 | |
| 7694 | +| callback | [AuthCallback](#authcallback9) | 是 | 回调对象,用于返回鉴权结果。 | | ||
| 7695 | + | ||
| 7696 | +### auth<sup>23+</sup> | ||
| 7697 | + | ||
| 7698 | +auth(name: string, authType: string, options: Record<string, RecordData>, callback: AuthCallback): void | ||
| 7699 | + | ||
| 7700 | +对应用账号进行鉴权以获取授权令牌。使用callback异步回调。 | ||
| 7701 | + | ||
| 7702 | +**系统能力:** SystemCapability.Account.AppAccount | ||
| 7703 | + | ||
| 7704 | +**参数:** | ||
| 7705 | + | ||
| 7706 | +| 参数名 | 类型 | 必填 | 说明 | | ||
| 7707 | +| ---------------- | --------------------- | ---- | --------------- | | ||
| 7708 | +| name | string | 是 | 应用账号的名称。 | | ||
| 7709 | +| authType | string | 是 | 应用账号的鉴权类型。 | | ||
| 7710 | +| options | Record<string, RecordData>| 是 | 鉴权所需要的可选项。 | | ||
| 7671 | | callback | [AuthCallback](#authcallback9) | 是 | 回调对象,用于返回鉴权结果。 | | 7711 | | callback | [AuthCallback](#authcallback9) | 是 | 回调对象,用于返回鉴权结果。 | |
| 7672 | 7712 | ||
| 7673 | ### authenticate<sup>(deprecated)</sup> | 7713 | ### authenticate<sup>(deprecated)</sup> |