1# 帐号变更说明 2 3## cl.account_os_account.1 删除应用帐号授权接口 4 5**变更影响** 6 7基于此前版本开发的应用,无法继续使用帐号授权能力。 8 9**关键接口/组件变更** 10 11涉及接口: 12 13interface/sdk-js/api/@ohos.account.appAccount.d.ts: 14 15```js 16 enum AccountCapabilityType 17``` 18```js 19 class AccountCapabilityProvider 20``` 21```js 22 class AuthorizationProvider extends AccountCapabilityProvider 23``` 24```js 25 interface AuthorizationProviderInfo 26``` 27```js 28 class AccountCapabilityRequest 29``` 30```js 31 class AccountCapabilityResponse 32``` 33```js 34 class AccountCapabilityScheduler 35``` 36 37interface/sdk-js/api/@ohos.account.appAccount.AuthorizationExtensionAbility.d.ts: 38 39```js 40 export default class AuthorizationExtensionAbility extends ExtensionAbility 41``` 42```js 43 declare interface AuthorizationRequest 44``` 45```js 46 declare interface AuthorizationCallback 47``` 48 49 50变更后: 51 52涉及接口全部删除。 53 54**适配指导** 55 56该接口删除后无法再使用,请同步删除相应功能。 57 58 59## cl.account_os_account.2 系统帐号添加凭据接口错误码变更 60 61**变更影响** 62 63基于此前版本开发的应用,需要重新适配旧错误码场景的分支判断。 64 65**关键接口/组件变更** 66 67涉及接口: 68 69```js 70 class UserIdentityManager { 71 ... 72 addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; 73 ... 74 } 75``` 76 77错误码列表: 78| 错误码ID | 错误信息 | 79| -------- | ------------------- | 80| 12300001 | System service exception. | 81| 12300002 | Invalid credentialInfo, i.e. authType or authSubType. | 82| 12300101 | Token is invalid. | 83| 12300106 | Unsupported authType. | 84| 12300109 | Operation is canceled. | 85| 12300111 | Operation timeout. | 86| 12300115 | The number of credentials reaches the upper limit. | 87 88 89变更前: 90会话超时异常场景对应的错误码返回为12300002 91 92变更后: 93会话超时异常场景对应的错误码返回为12300001 94 95 96**适配指导** 97 98根据错误码变更场景进行排查适配。 99 100 101## cl.account_os_account.3 域插件查询帐号信息接口变更 102 103域插件查询帐号信息接口getAccountInfo变更,为提高接参数的可扩展性,将原来的方法中的指定类型入参,替换为可扩展类型(GetDomainAccountInfoPluginOptions)入参。 104 105**变更影响** 106 107开发者需要适配新的入参类型,否则将导致编译失败。适配方式请参考下文示例代码。 108 109**关键接口/组件变更** 110 111变更前: 112 113```js 114 interface DomainPlugin { 115 ... 116 getAccountInfo(domain: string, accountName: string, callback: AsyncCallback<DomainAccountInfo>): void; 117 ... 118 } 119``` 120 121变更后: 122```js 123 interface DomainPlugin { 124 ... 125 getAccountInfo(options: GetDomainAccountInfoPluginOptions, callback: AsyncCallback<DomainAccountInfo>): void; 126 ... 127 } 128``` 129 130**适配指导** 131 132接口入参修改为指定GetDomainAccountInfoPluginOptions类型,示例代码如下。 133 134```js 135 let plugin: account_osAccount.DomainPlugin = { 136 auth: (domainAccountInfo: account_osAccount.DomainAccountInfo, credential: Uint8Array, 137 callback: account_osAccount.IUserAuthCallback) => {}, 138 authWithPopup: (domainAccountInfo: account_osAccount.DomainAccountInfo, 139 callback: account_osAccount.IUserAuthCallback) => {}, 140 authWithToken: (domainAccountInfo: account_osAccount.DomainAccountInfo, token: Uint8Array, 141 callback: account_osAccount.IUserAuthCallback) => {}, 142 getAccountInfo: (options: account_osAccount.GetDomainAccountInfoPluginOptions, // 接口入参变更 143 callback: AsyncCallback<account_osAccount.DomainAccountInfo>) => { 144 // mock getting account information 145 // notify result 146 let code: BusinessError = { 147 code: 0, 148 name: "", 149 message: "" 150 }; 151 let accountInfo: account_osAccount.DomainAccountInfo = { 152 domain: options.domain, // 入参读取方式 153 accountName: options.accountName, // 入参读取方式 154 accountId: 'xxxx' 155 }; 156 callback(code, accountInfo); 157 }, 158 getAuthStatusInfo: (domainAccountInfo: account_osAccount.DomainAccountInfo, 159 callback: AsyncCallback<account_osAccount.AuthStatusInfo>) => {}, 160 bindAccount: (domainAccountInfo: account_osAccount.DomainAccountInfo, localId: number, 161 callback: AsyncCallback<void>) => {}, 162 unbindAccount: (domainAccountInfo: account_osAccount.DomainAccountInfo, callback: AsyncCallback<void>) => {}, 163 isAccountTokenValid: (domainAccountInfo: account_osAccount.DomainAccountInfo, token: Uint8Array, 164 callback: AsyncCallback<boolean>) => {}, 165 getAccessToken: (options: account_osAccount.GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>) => {} 166} 167 account_osAccount.DomainAccountManager.registerPlugin(plugin) 168``` 169