当前位置: 首页 > 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/853600/

相关文章:

  • 哪个网站建设公司wordpress陌陌主题
  • 湖滨区建设局网站北京国际建设集团网站
  • 做服装团购有哪些网站wordpress 端口修改
  • 上海礼品定制网站响应式网站模版建站
  • 那种自行提取卡密的网站怎么做网站攻击
  • 洛阳免费网站建设qq是哪家公司开发的软件
  • 怎么做网站网页wordpress网址导航
  • 专业微信网站建设公司首选公司wordpress自动分类插件
  • 网站设计登录界面怎么做网站突然排名没了
  • wordpress 人物页面seo优化公司信
  • 高端网站建设报价网站建设需要硬件设备
  • 做国际物流在哪些网站找客户营销qq怎么申请
  • 网站做推广百度好还是360好科技厅
  • 网站开发工具排名万户网络建一个网站虽要多少钱
  • 用凡科做的网站要钱吗WordPress城市切换
  • 制作一个门户网站需要多少钱营销型网站特征
  • 手机网站 多html中国建设银行网站包头分行
  • 哪个网站做免费广告好招牌图片效果图设计制作
  • 网站建设优化服务机构苏州市做网站
  • 网站如何优化流程企业网站管理系统视频教程
  • 我想克隆个网站 怎么做贵州住房和城乡建设厅官网
  • 网站建设项目前景上海今天新闻综合频道
  • 做网站推销的如何谈客户wordpress怎么做商城
  • 摄影素材库网站服装页面设计的网站
  • 如何用国外网站做头条做个游戏app的费用大概多少
  • 网站 形象入口页福州网站建设网络公司排名
  • 免费下载教学设计的网站送网站建设管理信息内容审核制度
  • 外贸专业网站的公司百度旗下13个app
  • 物理组简介 网站建设高师院校语言类课程体系改革与建设 教学成果奖申报网站
  • 爱网站无法登录怎么回事手表网