当前位置: 首页 > news >正文

网站怎样制作图文排版网站建设正文字体多大合适

网站怎样制作图文排版,网站建设正文字体多大合适,太湖县网站建设公司,汕头建站公司模板应用帐号管理 说明#xff1a; 本模块首批接口从API version 7开始支持。后续版本的新增接口#xff0c;采用上角标单独标记接口的起始版本。开发前请熟悉鸿蒙开发指导文档#xff1a;gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md点击或者复制转到。 导入模…应用帐号管理 说明  本模块首批接口从API version 7开始支持。后续版本的新增接口采用上角标单独标记接口的起始版本。开发前请熟悉鸿蒙开发指导文档gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md点击或者复制转到。 导入模块 import account_appAccount from ohos.account.appAccount;account_appAccount.createAppAccountManager createAppAccountManager(): AppAccountManager 应用帐号管理获取应用帐号模块对象。 系统能力  SystemCapability.Account.AppAccount 返回值 类型说明AppAccountManager获取应用帐号模块的实例。 示例 const appAccountManager account_appAccount.createAppAccountManager();AppAccountManager 管理应用帐号模块的实例。 addAccount addAccount(name: string, callback: AsyncCallback): void 将此应用的帐号名添加到帐号管理服务中使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是要添加的应用帐户的名称。callbackAsyncCallback是将此应用的帐号名添加到帐号管理服务的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.addAccount(WangWu, (err) { console.log(addAccount err: JSON.stringify(err)); });addAccount addAccount(name: string, extraInfo: string, callback: AsyncCallback): void 将此应用程序的帐号名和额外信息添加到帐号管理服务中使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是要添加的应用帐户的名称。extraInfostring是要添加的应用帐户的额外信息(例如token等)额外的信息不能是应用帐号的敏感信息。callbackAsyncCallback是将此应用程序的帐号名和额外信息添加到帐号管理服务中的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.addAccount(LiSi, token101, (err) { console.log(addAccount err: JSON.stringify(err)); });addAccount addAccount(name: string, extraInfo?: string): Promise 将此应用的帐号名或额外信息添加到帐号管理服务中使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是要添加的应用帐户的名称。extraInfostring是要添加的应用帐户的额外信息额外的信息不能是应用帐号的敏感信息。 返回值 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.addAccount(LiSi, token101).then(() { console.log(addAccount Success); }).catch((err) {console.log(addAccount err: JSON.stringify(err)); });addAccountImplicitly8 addAccountImplicitly(owner: string, authType: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void 根据指定的帐号所有者、鉴权类型和可选项隐式地添加应用帐号并使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明ownerstring是要添加的应用帐户的所有者包名。authTypestring是要添加的应用帐户的鉴权类型。options{[key: string]: any}是鉴权所需要的可选项。callbackAuthenticatorCallback是认证器回调用于返回鉴权结果。 示例 import featureAbility from ohos.ability.featureAbility;function onResultCallback(code, result) {console.log(resultCode: code);console.log(result: JSON.stringify(result)); }function onRequestRedirectedCallback(request) {let abilityStartSetting {want: request};featureAbility.startAbility(abilityStartSetting, (err){console.log(startAbility err: JSON.stringify(err));}); }const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.addAccountImplicitly(LiSi, readAge, {}, {onResult: onResultCallback,onRequestRedirected: onRequestRedirectedCallback });deleteAccount deleteAccount(name: string, callback: AsyncCallback): void 从帐号管理服务中删除应用帐号使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是要删除的应用帐户的名称。callbackAsyncCallback是帐号管理服务中删除应用帐号的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.deleteAccount(ZhaoLiu, (err) { console.log(deleteAccount err: JSON.stringify(err));});deleteAccount deleteAccount(name: string): Promise 从帐号管理服务中删除应用帐号使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是要删除的应用帐户的名称。 返回值 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.deleteAccount(ZhaoLiu).then(() { console.log(deleteAccount Success);}).catch((err) {console.log(deleteAccount err: JSON.stringify(err)); });disableAppAccess disableAppAccess(name: string, bundleName: string, callback: AsyncCallback): void 禁止指定第三方应用帐户的名称访问指定包名称的第三方应用使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是要禁用访问的第三方应用帐户的名称。bundleNamestring是第三方应用的包名。callbackAsyncCallback是禁止指定第三方应用帐户的名称访问指定包名称的第三方应用的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.disableAppAccess(ZhangSan, com.example.ohos.accountjsdemo, (err) { console.log(disableAppAccess err: JSON.stringify(err)); });disableAppAccess disableAppAccess(name: string, bundleName: string): Promise 禁止指定第三方应用帐户的名称访问指定包名称的第三方应用使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是要禁用访问的第三方应用帐户的名称。bundleNamestring是第三方应用的包名。 返回值 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.disableAppAccess(ZhangSan, com.example.ohos.accountjsdemo).then(() { console.log(disableAppAccess Success); }).catch((err) {console.log(disableAppAccess err: JSON.stringify(err)); });enableAppAccess enableAppAccess(name: string, bundleName: string, callback: AsyncCallback): void 允许指定第三方应用帐户的名称访问指定包名称的第三方应用使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐号名称。bundleNamestring是第三方应用的包名。callbackAsyncCallback是允许指定第三方应用帐户的名称访问指定包名称的第三方应用的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.enableAppAccess(ZhangSan, com.example.ohos.accountjsdemo, (err) { console.log(enableAppAccess: JSON.stringify(err));});enableAppAccess enableAppAccess(name: string, bundleName: string): Promise 允许指定第三方应用帐户的名称访问指定包名称的第三方应用使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐号名称。bundleNamestring是第三方应用的包名。 返回值 类型说明PromisePromise实例用于获取异步返回结果。 示例 app_account_instance.enableAppAccess(ZhangSan, com.example.ohos.accountjsdemo).then(() { console.log(enableAppAccess Success); }).catch((err) {console.log(enableAppAccess err: JSON.stringify(err)); });checkAppAccountSyncEnable checkAppAccountSyncEnable(name: string, callback: AsyncCallback): void 检查指定应用帐号是否允许应用数据同步使用callback回调异步返回结果。 需要权限  ohos.permission.DISTRIBUTED_DATASYNC仅系统应用可用。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐号名称。callbackAsyncCallback是检查指定应用帐号是否允许应用数据同步的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.checkAppAccountSyncEnable(ZhangSan, (err, result) { console.log(checkAppAccountSyncEnable err: JSON.stringify(err));console.log(checkAppAccountSyncEnable result: result); });checkAppAccountSyncEnable checkAppAccountSyncEnable(name: string): Promise 检查指定应用帐号是否允许应用数据同步使用Promise方式异步返回结果。 需要权限  ohos.permission.DISTRIBUTED_DATASYNC仅系统应用可用。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐号名称。 返回值 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.checkAppAccountSyncEnable(ZhangSan).then((data) { console.log(checkAppAccountSyncEnable, result: data); }).catch((err) {console.log(checkAppAccountSyncEnable err: JSON.stringify(err)); });setAccountCredential setAccountCredential(name: string, credentialType: string, credential: string,callback: AsyncCallback): void 设置此应用程序帐号的凭据使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用程序帐户的名称。credentialTypestring是要设置的凭据的类型。credentialstring是要设置的凭据。callbackAsyncCallback是设置此应用帐号的凭据的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.setAccountCredential(ZhangSan, credentialType001, credential001, (err) { console.log(setAccountCredential err: JSON.stringify(err)); });setAccountCredential setAccountCredential(name: string, credentialType: string, credential: string): Promise 设置此应用程序帐号的凭据使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。credentialTypestring是要设置的凭据的类型。credentialstring是要设置的凭据。 返回值 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.setAccountCredential(ZhangSan, credentialType001, credential001).then(() { console.log(setAccountCredential Success); }).catch((err) {console.log(setAccountCredential err: JSON.stringify(err)); });setAccountExtraInfo setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback): void 设置此应用程序帐号的额外信息使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。extraInfostring是要设置的额外信息。callbackAsyncCallback是设置此应用帐号的额外信息的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.setAccountExtraInfo(ZhangSan, Tk002, (err) { console.log(setAccountExtraInfo err: JSON.stringify(err)); });setAccountExtraInfo setAccountExtraInfo(name: string, extraInfo: string): Promise 设置此应用程序帐号的额外信息使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。extraInfostring是要设置的额外信息。 返回值 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.setAccountExtraInfo(ZhangSan, Tk002).then(() { console.log(setAccountExtraInfo Success); }).catch((err) {console.log(setAccountExtraInfo err: JSON.stringify(err)); });setAppAccountSyncEnable setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback): void 设置指定的应用程序帐号是否允许应用程序数据同步使用callback回调异步返回结果。 需要权限  ohos.permission.DISTRIBUTED_DATASYNC仅系统应用可用。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。isEnableboolean是是否允许应用数据同步。callbackAsyncCallback是设置指定的应用帐号是否允许应用程序数据同步的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.setAppAccountSyncEnable(ZhangSan, true, (err) { console.log(setAppAccountSyncEnable err: JSON.stringify(err)); });setAppAccountSyncEnable setAppAccountSyncEnable(name: string, isEnable: boolean): Promise 设置指定的应用程序帐号是否允许应用程序数据同步使用Promise方式异步返回结果。 需要权限  ohos.permission.DISTRIBUTED_DATASYNC仅系统应用可用。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。isEnableboolean是是否允许应用数据同步。 返回值 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager .setAppAccountSyncEnable(ZhangSan, true).then(() { console.log(setAppAccountSyncEnable Success); }).catch((err) {console.log(setAppAccountSyncEnable err: JSON.stringify(err)); });setAssociatedData setAssociatedData(name: string, key: string, value: string, callback: AsyncCallback): void 设置与此应用程序帐号关联的数据使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。keystring是要设置的数据的键密钥可以自定义。valuestring是要设置的数据的值。callbackAsyncCallback是设置与此应用帐号关联的数据的回调。 示例 app_account_instance.setAssociatedData(ZhangSan, k001, v001, (err) { console.log(setAssociatedData err: JSON.stringify(err)); });setAssociatedData setAssociatedData(name: string, key: string, value: string): Promise 设置与此应用程序帐号关联的数据使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。keystring是要设置的数据的键密钥可以自定义。valuestring是要设置的数据的值。 返回值 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.setAssociatedData(ZhangSan, k001, v001).then(() { console.log(setAssociatedData Success); }).catch((err) {console.log(setAssociatedData err: JSON.stringify(err)); });getAccountCredential getAccountCredential(name: string, credentialType: string, callback: AsyncCallback): void 获取此应用帐号的凭据使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐号名称。credentialTypestring是要获取的凭据的类型。callbackAsyncCallback是获取此应用帐号的凭据的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getAccountCredential(ZhangSan, credentialType001, (err, result) { console.log(getAccountCredential err: JSON.stringify(err));console.log(getAccountCredential result: result); });getAccountCredential getAccountCredential(name: string, credentialType: string): Promise 获取此应用程序帐号的凭据使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐号名称。credentialTypestring是要获取的凭据的类型。 返回值 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getAccountCredential(ZhangSan, credentialType001).then((data) { console.log(getAccountCredential, result: data); }).catch((err) {console.log(getAccountCredential err: JSON.stringify(err)); });getAccountExtraInfo getAccountExtraInfo(name: string, callback: AsyncCallback): void 获取此应用帐号的额外信息使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐号名称。callbackAsyncCallback是获取此应用帐号的额外信息的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getAccountExtraInfo(ZhangSan, (err, result) { console.log(getAccountExtraInfo err: JSON.stringify(err));console.log(getAccountExtraInfo result: result); });getAccountExtraInfo getAccountExtraInfo(name: string): Promise 获取此应用程序帐号的额外信息使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐号名称。 返回值 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getAccountExtraInfo(ZhangSan).then((data) { console.log(getAccountExtraInfo, result: data); }).catch((err) {console.log(getAccountExtraInfo err: JSON.stringify(err)); });getAssociatedData getAssociatedData(name: string, key: string, callback: AsyncCallback): void 获取与此应用程序帐号关联的数据使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐号名称。keystring是要获取的数据的key。callbackAsyncCallback是获取与此应用帐号关联的数据的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getAssociatedData(ZhangSan, k001, (err, result) { console.log(getAssociatedData err: JSON.stringify(err));console.log(getAssociatedData result: result); });getAssociatedData getAssociatedData(name: string, key: string): Promise 获取与此应用程序帐号关联的数据使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐号名称。keystring是要获取的数据的key。 返回值 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getAssociatedData(ZhangSan, k001).then((data) { console.log(getAssociatedData: data); }).catch((err) {console.log(getAssociatedData err: JSON.stringify(err)); });getAllAccessibleAccounts getAllAccessibleAccounts(callback: AsyncCallbackArray): void 获取全部应用已授权帐号信息。 需要权限  ohos.permission.GET_ALL_APP_ACCOUNTS仅系统应用可用。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明callbackAsyncCallbackArray是应用帐号信息列表 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getAllAccessibleAccounts((err, data){console.debug(getAllAccessibleAccounts err: JSON.stringify(err));console.debug(getAllAccessibleAccounts data: JSON.stringify(data)); });getAllAccessibleAccounts getAllAccessibleAccounts(): PromiseArray 获取全部应用已授权帐号信息。 需要权限  ohos.permission.GET_ALL_APP_ACCOUNTS仅系统应用可用。 系统能力  SystemCapability.Account.AppAccount 参数 类型说明PromiseArrayPromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getAllAccessibleAccounts().then((data) { console.log(getAllAccessibleAccounts: data); }).catch((err) {console.log(getAllAccessibleAccounts err: JSON.stringify(err)); });getAllAccounts getAllAccounts(owner: string, callback: AsyncCallbackArray): void 获取指定应用全部帐号信息。 需要权限  ohos.permission.GET_ALL_APP_ACCOUNTS仅系统应用可用。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明ownerstring是应用包名称callbackAsyncCallbackArray是应用帐号信息列表 示例 const appAccountManager account.createAppAccountManager(); const selfBundle com.example.actsgetallaaccounts; appAccountManager.getAllAccounts(selfBundle, (err, data){console.debug(getAllAccounts err: JSON.stringify(err));console.debug(getAllAccounts data: JSON.stringify(data)); });getAllAccounts getAllAccounts(owner: string): PromiseArray 获取指定应用全部帐号信息。 需要权限  ohos.permission.GET_ALL_APP_ACCOUNTS仅系统应用可用。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明ownerstring是应用包名称 参数 类型说明PromiseArrayPromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); const selfBundle com.example.actsgetallaaccounts; appAccountManager.getAllAccounts(selfBundle).then((data) { console.log(getAllAccounts: data); }).catch((err) {console.log(getAllAccounts err: JSON.stringify(err)); });on(‘change’) on(type: ‘change’, owners: Array, callback: CallbackArray): void 订阅指定帐号所有者的帐户变更事件使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明type‘change’是关于帐户更改事件当帐户所有者更新帐户时订阅者将收到通知。ownersArray是指示帐户的所有者。callbackCallbackArray是订阅指定帐号所有者的帐户变更事件的回调。 示例 const appAccountManager account.createAppAccountManager(); function changeOnCallback(data){console.debug(receive change data: JSON.stringify(data)); } try{appAccountManager.on(change, [com.example.actsaccounttest], changeOnCallback); } catch(err){console.error(on accountOnOffDemo err: JSON.stringify(err)); }off(‘change’) off(type: ‘change’, callback?: CallbackArray): void 取消订阅帐号事件使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明type‘change’是关于帐户更改事件。callbackCallbackArray否取消订阅帐号事件的回调。 示例 const appAccountManager account.createAppAccountManager(); function changeOnCallback(data){console.debug(receive change data: JSON.stringify(data));appAccountManager.off(change, function(){console.debug(off finish);}) } try{appAccountManager.on(change, [com.example.actsaccounttest], changeOnCallback); } catch(err){console.error(on accountOnOffDemo err: JSON.stringify(err)); }authenticate8 authenticate(name: string, owner: string, authType: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void 鉴权应用帐户以获取OAuth令牌使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是要鉴权的应用帐户的名称。ownerstring是要鉴权的应用帐户的所有者包名。authTypestring是鉴权类型。options{[key: string]: any}是鉴权所需的可选项。callbackAuthenticatorCallback是认证器回调用于返回鉴权结果。 示例 import featureAbility from ohos.ability.featureAbility;function onResultCallback(code, result) {console.log(resultCode: code);console.log(result: JSON.stringify(result)); }function onRequestRedirectedCallback(request) {let abilityStartSetting {want: request};featureAbility.startAbility(abilityStartSetting, (err){console.log(startAbility err: JSON.stringify(err));}); }const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.authenticate(LiSi, com.example.ohos.accountjsdemo, readAge, {}, {onResult: onResultCallback,onRequestRedirected: onRequestRedirectedCallback });getOAuthToken8 getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback): void 获取指定应用帐户和鉴权类型的OAuth令牌使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。ownerstring是应用帐户的所有者包名。authTypestring是鉴权类型。callbackAsyncCallback是查询结果的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getOAuthToken(LiSi, com.example.ohos.accountjsdemo, readAge, (err, data) {console.log(getOAuthToken err: JSON.stringify(err));console.log(getOAuthToken token: data); });getOAuthToken8 getOAuthToken(name: string, owner: string, authType: string): Promise 获取指定应用帐户和鉴权类型的OAuth令牌使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。ownerstring是应用帐户的所有者包名。authTypestring是鉴权类型。 参数 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getOAuthToken(LiSi, com.example.ohos.accountjsdemo, readAge).then((data) {console.log(getOAuthToken token: data); }).catch((err) {console.log(getOAuthToken err: JSON.stringify(err)); });setOAuthToken8 setOAuthToken(name: string, authType: string, token: string, callback: AsyncCallback): void 设置指定应用帐户和鉴权类型的OAuth令牌使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。authTypestring是鉴权类型。tokenstring是OAuth令牌。callbackAsyncCallback是设置结果的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.setOAuthToken(LiSi, readAge, xxxx, (err) {console.log(setOAuthToken err: JSON.stringify(err)); });setOAuthToken8 setOAuthToken(name: string, authType: string, token: string): Promise 设置指定应用帐户和鉴权类型的OAuth令牌使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。authTypestring是鉴权类型。tokenstring是OAuth令牌。 参数 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.setOAuthToken(LiSi, readAge, xxxx).then(() {console.log(setOAuthToken successfully); }).catch((err) {console.log(setOAuthToken err: JSON.stringify(err)); });deleteOAuthToken8 deleteOAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback): void 删除指定应用帐户和鉴权类型的OAuth令牌使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。ownerstring是应用帐户的所有者包名。authTypestring是鉴权类型。tokenstring是要删除的OAuth令牌。callbackAsyncCallback是删除结果的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.deleteOAuthToken(LiSi, com.example.ohos.accountjsdemo, readAge, xxxxx, (err) {console.log(deleteOAuthToken err: JSON.stringify(err)); });deleteOAuthToken8 deleteOAuthToken(name: string, owner: string, authType: string, token: string): Promise 删除指定应用帐户和鉴权类型的OAuth令牌使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。ownerstring是应用帐户的所有者包名。authTypestring是鉴权类型。tokenstring是要删除的OAuth令牌。 参数 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.deleteOAuthToken(LiSi, com.example.ohos.accountjsdemo, readAge, xxxxx).then(() {console.log(deleteOAuthToken successfully); }).catch((err) {console.log(deleteOAuthToken err: JSON.stringify(err)); });setOAuthTokenVisibility8 setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean, callback: AsyncCallback): void 设置指定鉴权类型的OAuth令牌对特定应用的可见性使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。authTypestring是鉴权类型。bundleNamestring是被设置可见性的应用包名。isVisibleboolean是是否可见。callbackAsyncCallback是设置结果的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.setOAuthTokenVisibility(LiSi, readAge, com.example.ohos.accountjsdemo, true, (err) {console.log(setOAuthTokenVisibility err: JSON.stringify(err)); });setOAuthTokenVisibility8 setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise 设置指定鉴权类型的OAuth令牌对特定应用的可见性使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。authTypestring是鉴权类型。bundleNamestring是被设置可见性的应用包名。isVisibleboolean是是否可见。 参数 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.setOAuthTokenVisibility(LiSi, readAge, com.example.ohos.accountjsdemo, true).then(() {console.log(setOAuthTokenVisibility successfully); }).catch((err) {console.log(setOAuthTokenVisibility err: JSON.stringify(err)); });checkOAuthTokenVisibility8 checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, callback: AsyncCallback): void 检查指定鉴权类型的OAuth令牌对特定应用的可见性使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。authTypestring是鉴权类型。bundleNamestring是用于检查可见性的应用包名。callbackAsyncCallback是检查结果的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.checkOAuthTokenVisibility(LiSi, readAge, com.example.ohos.accountjsdemo, true, (err, data) {console.log(checkOAuthTokenVisibility err: JSON.stringify(err));console.log(checkOAuthTokenVisibility isVisible: data); });checkOAuthTokenVisibility8 checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise 检查指定鉴权类型的OAuth令牌对特定应用的可见性使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。authTypestring是鉴权类型。bundleNamestring是用于检查可见性的应用包名。 参数 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.checkOAuthTokenVisibility(LiSi, readAge, com.example.ohos.accountjsdemo, true).then((data) {console.log(checkOAuthTokenVisibility isVisible: data); }).catch((err) {console.log(checkOAuthTokenVisibility err: JSON.stringify(err)); });getAllOAuthTokens8 getAllOAuthTokens(name: string, owner: string, callback: AsyncCallbackArray): void 获取指定应用对调用方全部可见的OAuth令牌使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。ownerstring是应用帐户的所有者包名。callbackAsyncCallbackArray是查询结果的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getAllOAuthTokens(LiSi, com.example.ohos.accountjsdemo, (err, data) {console.log(getAllOAuthTokens err: JSON.stringify(err));console.log(getAllOAuthTokens data: JSON.stringify(data)); });getAllOAuthTokens8 getAllOAuthTokens(name: string, owner: string): PromiseArray 获取指定应用帐户对调用方可见的全部OAuth令牌使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。ownerstring是应用帐户的所有者包名。 参数 类型说明PromiseArrayPromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getAllOAuthTokens(LiSi, com.example.ohos.accountjsdemo).then((data) {console.log(getAllOAuthTokens data: JSON.stringify(data)); }).catch((err) {console.log(getAllOAuthTokens err: JSON.stringify(err)); });getOAuthList8 getOAuthList(name: string, authType: string, callback: AsyncCallbackArray): void 获取指定应用帐户和鉴权类型的OAuth令牌的授权列表使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。ownerstring是应用帐户的所有者包名。callbackAsyncCallbackArray是查询结果的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getOAuthList(com.example.ohos.accountjsdemo, readAge, (err, data) {console.log(getOAuthList err: JSON.stringify(err));console.log(getOAuthList data: JSON.stringify(data)); });getOAuthList8 getOAuthList(name: string, authType: string): PromiseArray 获取指定应用帐户和鉴权类型的OAuth令牌的授权列表使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明namestring是应用帐户的名称。ownerstring是应用帐户的所有者包名。 参数 类型说明PromiseArrayPromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getOAuthList(com.example.ohos.accountjsdemo, readAge).then((data) {console.log(getOAuthList data: JSON.stringify(data)); }).catch((err) {console.log(getOAuthList err: JSON.stringify(err)); });getAuthenticatorCallback8 getAuthenticatorCallback(sessionId: string, callback: AsyncCallback): void 获取鉴权会话的认证器回调使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明sessionIdstring是鉴权会话的标识。callbackAsyncCallback是查询结果的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); featureAbility.getWant((err, want) {var sessionId want.parameters[account_appAccount.Constants.KEY_SESSION_ID];appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) {if (err.code ! account_appAccount.ResultCode.SUCCESS) {console.log(getAuthenticatorCallback err: JSON.stringify(err));return;}var result {[account_appAccount.Constants.KEY_NAME]: LiSi,[account_appAccount.Constants.KEY_OWNER]: com.example.ohos.accountjsdemo,[account_appAccount.Constants.KEY_AUTH_TYPE]: readAge,[account_appAccount.Constants.KEY_TOKEN]: xxxxxx};callback.OnResult(account_appAccount.ResultCode.SUCCESS, result);}); });getAuthenticatorCallback8 getAuthenticatorCallback(sessionId: string): Promise 获取鉴权会话的认证器回调使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明sessionIdstring是鉴权会话的标识。 参数 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); featureAbility.getWant().then((want) {var sessionId want.parameters[account_appAccount.Constants.KEY_SESSION_ID];appAccountManager.getAuthenticatorCallback(sessionId).then((callback) {var result {[account_appAccount.Constants.KEY_NAME]: LiSi,[account_appAccount.Constants.KEY_OWNER]: com.example.ohos.accountjsdemo,[account_appAccount.Constants.KEY_AUTH_TYPE]: readAge,[account_appAccount.Constants.KEY_TOKEN]: xxxxxx};callback.OnResult(account_appAccount.ResultCode.SUCCESS, result);}).catch((err) {console.log(getAuthenticatorCallback err: JSON.stringify(err));}); }).catch((err) {console.log(getWant err: JSON.stringify(err)); });getAuthenticatorInfo8 getAuthenticatorInfo(owner: string, callback: AsyncCallback): void 获取指定应用帐户的认证器信息使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明ownerstring是应用帐户的所有者包名。callbackAsyncCallback是查询结果的回调。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getAuthenticatorInfo(com.example.ohos.accountjsdemo, (err, data) {console.log(getAuthenticatorInfo err: JSON.stringify(err));console.log(getAuthenticatorInfo data: JSON.stringify(data)); });getAuthenticatorInfo8 getAuthenticatorInfo(owner: string): Promise 获取指定应用帐户的认证器信息使用Promise方式异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明ownerstring是应用帐户的所有者包名。 参数 类型说明PromisePromise实例用于获取异步返回结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); appAccountManager.getAuthenticatorInfo(com.example.ohos.accountjsdemo).then((data) { console.log(getAuthenticatorInfo: JSON.stringify(data)); }).catch((err) {console.log(getAuthenticatorInfo err: JSON.stringify(err)); });AppAccountInfo 表示应用帐号信息。 系统能力  以下各项对应的系统能力均为SystemCapability.Account.AppAccount。 参数名类型必填说明ownerstring是应用帐户的所有者包名。namestring是应用帐户的名称。 OAuthTokenInfo8 表示OAuth令牌信息。 系统能力  以下各项对应的系统能力均为SystemCapability.Account.AppAccount。 参数名类型必填说明authTypestring是令牌的鉴权类型。tokenstring是令牌的取值。 AuthenticatorInfo8 表示OAuth认证器信息。 系统能力  以下各项对应的系统能力均为SystemCapability.Account.AppAccount。 参数名类型必填说明ownerstring是认证器的所有者包名。iconIdstring是认证器的图标标识。labelIdstring是认证器的标签标识。 Constants8 表示常量的枚举。 系统能力  以下各项对应的系统能力均为SystemCapability.Account.AppAccount。 名称默认值描述ACTION_ADD_ACCOUNT_IMPLICITLY“addAccountImplicitly”表示操作_隐式添加帐号。ACTION_AUTHENTICATE“authenticate”表示操作_鉴权。KEY_NAME“name”表示键名_应用帐户名称。KEY_OWNER“owner”表示键名_应用帐户所有者。KEY_TOKEN“token”表示键名_令牌。KEY_ACTION“action”表示键名_操作。KEY_AUTH_TYPE“authType”表示键名_鉴权类型。KEY_SESSION_ID“sessionId”表示键名_会话标识。KEY_CALLER_PID“callerPid”表示键名_调用方PID。KEY_CALLER_UID“callerUid”表示键名_调用方UID。KEY_CALLER_BUNDLE_NAME“callerBundleName”表示键名_调用方包名。 ResultCode8 表示返回码的枚举。 系统能力  以下各项对应的系统能力均为SystemCapability.Account.AppAccount。 名称默认值描述SUCCESS0表示操作成功。ERROR_ACCOUNT_NOT_EXIST10001表示应用帐户不存在。ERROR_APP_ACCOUNT_SERVICE_EXCEPTION10002表示应用帐户服务异常。ERROR_INVALID_PASSWORD10003表示密码无效。ERROR_INVALID_REQUEST10004表示请求无效。ERROR_INVALID_RESPONSE10005表示响应无效。ERROR_NETWORK_EXCEPTION10006表示网络异常。ERROR_OAUTH_AUTHENTICATOR_NOT_EXIST10007表示认证器不存在。ERROR_OAUTH_CANCELED10008表示鉴权取消。ERROR_OAUTH_LIST_TOO_LARGE10009表示开放授权列表过大。ERROR_OAUTH_SERVICE_BUSY10010表示开放授权服务忙碌。ERROR_OAUTH_SERVICE_EXCEPTION10011表示开放授权服务异常。ERROR_OAUTH_SESSION_NOT_EXIST10012表示鉴权会话不存在。ERROR_OAUTH_TIMEOUT10013表示鉴权超时。ERROR_OAUTH_TOKEN_NOT_EXIST10014表示开放授权令牌不存在。ERROR_OAUTH_TOKEN_TOO_MANY10015表示开放授权令牌过多。ERROR_OAUTH_UNSUPPORT_ACTION10016表示不支持的鉴权操作。ERROR_OAUTH_UNSUPPORT_AUTH_TYPE10017表示不支持的鉴权类型。ERROR_PERMISSION_DENIED10018表示权限不足。 AuthenticatorCallback8 OAuth认证器回调接口。 onResult8 onResult: (code: number, result: {[key: string]: any}) void 通知鉴权结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明codenumber是鉴权结果码。result{[key: string]: any}是鉴权结果。 示例 const appAccountManager account_appAccount.createAppAccountManager(); var sessionId 1234; appAccountManager.getAuthenticatorCallback(sessionId).then((callback) {var result {[account_appAccount.Constants.KEY_NAME]: LiSi,[account_appAccount.Constants.KEY_OWNER]: com.example.ohos.accountjsdemo,[account_appAccount.Constants.KEY_AUTH_TYPE]: readAge,[account_appAccount.Constants.KEY_TOKEN]: xxxxxx};callback.OnResult(account_appAccount.ResultCode.SUCCESS, result); }).catch((err) {console.log(getAuthenticatorCallback err: JSON.stringify(err)); });onRequestRedirected8 onRequestRedirected: (request: Want) void 通知鉴权请求被跳转。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明requestWant是用于跳转的请求信息。 示例 class MyAuthenticator extends account_appAccount.Authenticator {addAccountImplicitly(authType, callerBundleName, options, callback) {callback.onRequestRedirected({bundleName: com.example.ohos.accountjsdemo,abilityName: com.example.ohos.accountjsdemo.LoginAbility,});}authenticate(name, authType, callerBundleName, options, callback) {var result {[account_appAccount.Constants.KEY_NAME]: name,[account_appAccount.Constants.KEY_AUTH_TYPE]: authType,[account_appAccount.Constants.KEY_TOKEN]: xxxxxx};callback.onResult(account_appAccount.ResultCode.SUCCESS, result);} }Authenticator8 OAuth认证器基类。 addAccountImplicitly8 addAccountImplicitly(authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void 根据指定的鉴权类型和可选项隐式地添加应用帐户并使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 参数名类型必填说明authTypestring是应用帐户的鉴权类型。callerBundleNamestring是鉴权请求方的包名。options{[key: string]: any}是鉴权所需要的可选项。callbackAuthenticatorCallback是认证器回调用于返回鉴权结果。 authenticate8 authenticate(name: string, authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void 对应用帐户进行鉴权获取OAuth令牌并使用callback回调异步返回结果。 系统能力  SystemCapability.Account.AppAccount 参数 接口名类型必填说明 HarmonyOS与OpenHarmony鸿蒙文档籽料mau123789是v直接拿namestring是应用帐户的名称。authTypestring是应用帐户的鉴权类型。callerBundleNamestring是鉴权请求方的包名。options{[key: string]: any}是鉴权所需要的可选项。callbackAuthenticatorCallback是认证器回调用于返回鉴权结果。 示例 class MyAuthenticator extends account_appAccount.Authenticator {addAccountImplicitly(authType, callerBundleName, options, callback) {callback.onRequestRedirected({bundleName: com.example.ohos.accountjsdemo,abilityName: com.example.ohos.accountjsdemo.LoginAbility,});}authenticate(name, authType, callerBundleName, options, callback) {var result {[account_appAccount.Constants.KEY_NAME]: name,[account_appAccount.Constants.KEY_AUTH_TYPE]: authType,[account_appAccount.Constants.KEY_TOKEN]: xxxxxx};callback.onResult(account_appAccount.ResultCode.SUCCESS, result);} }export default {onConnect(want) {return new MyAuthenticator();} }
http://www.w-s-a.com/news/532471/

相关文章:

  • 中国建设协会官方网站前端培训的机构
  • 网站建设套餐是什么北京孤儿院做义工网站
  • 网站如何做微信支付链接做暧小视频xo免费网站
  • SEO案例网站建设重庆建站模板平台
  • 上海seo网站推广公司wordpress 小米商城主题
  • 搭建服务器做网站什么网站可以请人做软件
  • 上海建筑建材业网站迁移公家网站模板
  • 仿制别人的网站违法吗网站防火墙怎么做
  • 杨浦网站建设 网站外包公司如何进行网络推广
  • wordpress+仿站步骤超详细wordpress常用函数
  • 浙江手机版建站系统哪个好怎样黑进别人的网站
  • 企业网站搜索引擎推广方法装修网络公司
  • 网站运营优化建议wordpress 添加媒体
  • 用asp.net做网站计数器施工企业会计的内涵
  • 网站被黑咋样的网站建设 设计业务范围
  • 网站开发学哪种语言网站编辑器失效
  • WordPress插件提示信息江阴网站优化
  • 网站开发用的软件如何做网站内容管理
  • 扬州网站建设公司网站推广是什么岗位
  • 双线网站管理咨询公司是做什么
  • asia域名的网站贵州光利达建设工程有限公司局网站
  • 梅州南站济南做网络安全的公司
  • 网站源代码 phpseo营销推广费用
  • 南京专业制作网站深圳整装装修公司排名
  • 网站制作在哪里比较好网页设计的要点有哪些
  • 自己做网站原始代码高端品牌服装
  • 九度企业网站推广软件龙泉市建设局网站
  • 做个企业网网站怎么做专业3合1网站建设公司
  • 龙岩网站建设teams熊掌号公司网站的实例
  • 电商模板网站免费省级精品课程网站建设