提交 d0122526 编写于 作者: A Annie_wang
上级 1a49c90c
# @ohos.account.appAccount # @ohos.account.appAccount (App Account Management)
The **appAccount** module provides APIs for adding, deleting, modifying, and querying app account information, and supports inter-app authentication and distributed data synchronization. The **appAccount** module provides APIs for adding, deleting, modifying, and querying app account information, and supports inter-app authentication and distributed data synchronization.
...@@ -64,7 +64,6 @@ Creates an app account. This API uses an asynchronous callback to return the res ...@@ -64,7 +64,6 @@ Creates an app account. This API uses an asynchronous callback to return the res
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.createAccount("WangWu", (err) => { appAccountManager.createAccount("WangWu", (err) => {
console.log("createAccount err: " + JSON.stringify(err)); console.log("createAccount err: " + JSON.stringify(err));
...@@ -102,7 +101,6 @@ Creates an app account with custom data. This API uses an asynchronous callback ...@@ -102,7 +101,6 @@ Creates an app account with custom data. This API uses an asynchronous callback
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
let options = { let options = {
customData: { customData: {
"age": "10" "age": "10"
...@@ -155,7 +153,6 @@ Creates an app account with custom data. This API uses a promise to return the r ...@@ -155,7 +153,6 @@ Creates an app account with custom data. This API uses a promise to return the r
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
let options = { let options = {
customData: { customData: {
"age": "10" "age": "10"
...@@ -215,7 +212,6 @@ Creates an app account implicitly based on the specified account owner. This API ...@@ -215,7 +212,6 @@ Creates an app account implicitly based on the specified account owner. This API
}); });
} }
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.createAccountImplicitly("com.example.accountjsdemo", { appAccountManager.createAccountImplicitly("com.example.accountjsdemo", {
onResult: onResultCallback, onResult: onResultCallback,
...@@ -270,7 +266,6 @@ Creates an app account implicitly based on the specified account owner and optio ...@@ -270,7 +266,6 @@ Creates an app account implicitly based on the specified account owner and optio
}); });
} }
let appAccountManager = account_appAccount.createAppAccountManager();
let options = { let options = {
authType: "getSocialData", authType: "getSocialData",
requiredLabels: [ "student" ] requiredLabels: [ "student" ]
...@@ -311,7 +306,6 @@ Removes an app account. This API uses an asynchronous callback to return the res ...@@ -311,7 +306,6 @@ Removes an app account. This API uses an asynchronous callback to return the res
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.removeAccount("ZhaoLiu", (err) => { appAccountManager.removeAccount("ZhaoLiu", (err) => {
if (err) { if (err) {
...@@ -356,7 +350,6 @@ Removes an app account. This API uses a promise to return the result. ...@@ -356,7 +350,6 @@ Removes an app account. This API uses a promise to return the result.
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.removeAccount("Lisi").then(() => { appAccountManager.removeAccount("Lisi").then(() => {
console.log("removeAccount successfully"); console.log("removeAccount successfully");
...@@ -397,7 +390,6 @@ Sets the access to the data of an account for an app. This API uses an asynchron ...@@ -397,7 +390,6 @@ Sets the access to the data of an account for an app. This API uses an asynchron
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.setAppAccess("ZhangSan", "com.example.accountjsdemo", true, (err) => { appAccountManager.setAppAccess("ZhangSan", "com.example.accountjsdemo", true, (err) => {
if (err) { if (err) {
...@@ -445,7 +437,6 @@ Sets the access to the data of an account for an app. This API uses a promise to ...@@ -445,7 +437,6 @@ Sets the access to the data of an account for an app. This API uses a promise to
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.setAppAccess("ZhangSan", "com.example.accountjsdemo", true).then(() => { appAccountManager.setAppAccess("ZhangSan", "com.example.accountjsdemo", true).then(() => {
console.log("setAppAccess successfully"); console.log("setAppAccess successfully");
...@@ -485,7 +476,6 @@ Checks whether an app can access the data of an account. This API uses an asynch ...@@ -485,7 +476,6 @@ Checks whether an app can access the data of an account. This API uses an asynch
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.checkAppAccess("ZhangSan", "com.example.accountjsdemo", (err, isAccessible) => { appAccountManager.checkAppAccess("ZhangSan", "com.example.accountjsdemo", (err, isAccessible) => {
if (err) { if (err) {
...@@ -532,7 +522,6 @@ Checks whether an app can access the data of an account. This API uses a promise ...@@ -532,7 +522,6 @@ Checks whether an app can access the data of an account. This API uses a promise
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.checkAppAccess("ZhangSan", "com.example.accountjsdemo").then((isAccessible) => { appAccountManager.checkAppAccess("ZhangSan", "com.example.accountjsdemo").then((isAccessible) => {
console.log("checkAppAccess successfully, isAccessible: " + isAccessible); console.log("checkAppAccess successfully, isAccessible: " + isAccessible);
...@@ -573,7 +562,6 @@ Sets data synchronization for an app account. This API uses an asynchronous call ...@@ -573,7 +562,6 @@ Sets data synchronization for an app account. This API uses an asynchronous call
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.setDataSyncEnabled("ZhangSan", true, (err) => { appAccountManager.setDataSyncEnabled("ZhangSan", true, (err) => {
console.log("setDataSyncEnabled err: " + JSON.stringify(err)); console.log("setDataSyncEnabled err: " + JSON.stringify(err));
...@@ -617,7 +605,6 @@ Sets data synchronization for an app account. This API uses a promise to return ...@@ -617,7 +605,6 @@ Sets data synchronization for an app account. This API uses a promise to return
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager .setDataSyncEnabled("ZhangSan", true).then(() => { appAccountManager .setDataSyncEnabled("ZhangSan", true).then(() => {
console.log('setDataSyncEnabled Success'); console.log('setDataSyncEnabled Success');
...@@ -657,7 +644,6 @@ Checks whether data synchronization is enabled for an app account. This API uses ...@@ -657,7 +644,6 @@ Checks whether data synchronization is enabled for an app account. This API uses
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.checkDataSyncEnabled("ZhangSan", (err, isEnabled) => { appAccountManager.checkDataSyncEnabled("ZhangSan", (err, isEnabled) => {
if (err) { if (err) {
...@@ -704,7 +690,6 @@ Checks whether data synchronization is enabled for an app account. This API uses ...@@ -704,7 +690,6 @@ Checks whether data synchronization is enabled for an app account. This API uses
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.checkDataSyncEnabled("ZhangSan").then((isEnabled) => { appAccountManager.checkDataSyncEnabled("ZhangSan").then((isEnabled) => {
console.log("checkDataSyncEnabled successfully, isEnabled: " + isEnabled); console.log("checkDataSyncEnabled successfully, isEnabled: " + isEnabled);
...@@ -744,7 +729,6 @@ Sets a credential for an app account. This API uses an asynchronous callback to ...@@ -744,7 +729,6 @@ Sets a credential for an app account. This API uses an asynchronous callback to
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.setCredential("ZhangSan", "PIN_SIX", "xxxxxx", (err) => { appAccountManager.setCredential("ZhangSan", "PIN_SIX", "xxxxxx", (err) => {
if (err) { if (err) {
...@@ -791,7 +775,6 @@ Sets a credential for an app account. This API uses a promise to return the resu ...@@ -791,7 +775,6 @@ Sets a credential for an app account. This API uses a promise to return the resu
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.setCredential("ZhangSan", "PIN_SIX", "xxxxxx").then(() => { appAccountManager.setCredential("ZhangSan", "PIN_SIX", "xxxxxx").then(() => {
console.log("setCredential successfully"); console.log("setCredential successfully");
...@@ -831,7 +814,6 @@ Obtains the credential of an app account. This API uses an asynchronous callback ...@@ -831,7 +814,6 @@ Obtains the credential of an app account. This API uses an asynchronous callback
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.getCredential("ZhangSan", "PIN_SIX", (err, result) => { appAccountManager.getCredential("ZhangSan", "PIN_SIX", (err, result) => {
if (err) { if (err) {
...@@ -878,7 +860,6 @@ Obtains the credential of an app account. This API uses a promise to return the ...@@ -878,7 +860,6 @@ Obtains the credential of an app account. This API uses a promise to return the
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.getCredential("ZhangSan", "PIN_SIX").then((credential) => { appAccountManager.getCredential("ZhangSan", "PIN_SIX").then((credential) => {
console.log("getCredential successfully, credential: " + credential); console.log("getCredential successfully, credential: " + credential);
...@@ -919,7 +900,6 @@ Sets custom data for an app account. This API uses an asynchronous callback to r ...@@ -919,7 +900,6 @@ Sets custom data for an app account. This API uses an asynchronous callback to r
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.setCustomData("ZhangSan", "age", "12", (err) => { appAccountManager.setCustomData("ZhangSan", "age", "12", (err) => {
if (err) { if (err) {
...@@ -967,7 +947,6 @@ Sets custom data for an app account. This API uses a promise to return the resul ...@@ -967,7 +947,6 @@ Sets custom data for an app account. This API uses a promise to return the resul
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.setCustomData("ZhangSan", "age", "12").then(() => { appAccountManager.setCustomData("ZhangSan", "age", "12").then(() => {
console.log("setCustomData successfully"); console.log("setCustomData successfully");
...@@ -1007,7 +986,6 @@ Obtains the custom data of an app account based on the specified key. This API u ...@@ -1007,7 +986,6 @@ Obtains the custom data of an app account based on the specified key. This API u
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.getCustomData("ZhangSan", "age", (err, data) => { appAccountManager.getCustomData("ZhangSan", "age", (err, data) => {
if (err) { if (err) {
...@@ -1054,7 +1032,6 @@ Obtains the custom data of an app account based on the specified key. This API u ...@@ -1054,7 +1032,6 @@ Obtains the custom data of an app account based on the specified key. This API u
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.getCustomData("ZhangSan", "age").then((data) => { appAccountManager.getCustomData("ZhangSan", "age").then((data) => {
console.log("getCustomData successfully, data: " + data); console.log("getCustomData successfully, data: " + data);
...@@ -1099,7 +1076,6 @@ Obtains the custom data of an app account based on the specified key. The API re ...@@ -1099,7 +1076,6 @@ Obtains the custom data of an app account based on the specified key. The API re
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
let value = appAccountManager.getCustomDataSync("ZhangSan", "age"); let value = appAccountManager.getCustomDataSync("ZhangSan", "age");
console.info("getCustomDataSync successfully, vaue:" + value); console.info("getCustomDataSync successfully, vaue:" + value);
...@@ -1114,8 +1090,7 @@ getAllAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void ...@@ -1114,8 +1090,7 @@ getAllAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void
Obtains information about all accessible app accounts. This API uses an asynchronous callback to return the result. Obtains information about all accessible app accounts. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS **Required Permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS
**System capability**: SystemCapability.Account.AppAccount **System capability**: SystemCapability.Account.AppAccount
**Parameters** **Parameters**
...@@ -1133,7 +1108,6 @@ Obtains information about all accessible app accounts. This API uses an asynchro ...@@ -1133,7 +1108,6 @@ Obtains information about all accessible app accounts. This API uses an asynchro
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.getAllAccounts((err, data) => { appAccountManager.getAllAccounts((err, data) => {
if (err) { if (err) {
...@@ -1153,8 +1127,7 @@ getAllAccounts(): Promise<Array<AppAccountInfo>> ...@@ -1153,8 +1127,7 @@ getAllAccounts(): Promise<Array<AppAccountInfo>>
Obtains information about all accessible app accounts. This API uses a promise to return the result. Obtains information about all accessible app accounts. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS **Required Permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS
**System capability**: SystemCapability.Account.AppAccount **System capability**: SystemCapability.Account.AppAccount
**Return value** **Return value**
...@@ -1172,7 +1145,6 @@ Obtains information about all accessible app accounts. This API uses a promise t ...@@ -1172,7 +1145,6 @@ Obtains information about all accessible app accounts. This API uses a promise t
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.getAllAccounts().then((data) => { appAccountManager.getAllAccounts().then((data) => {
console.debug("getAllAccounts successfully"); console.debug("getAllAccounts successfully");
...@@ -1190,8 +1162,7 @@ getAccountsByOwner(owner: string, callback: AsyncCallback<Array<AppAccount ...@@ -1190,8 +1162,7 @@ getAccountsByOwner(owner: string, callback: AsyncCallback<Array<AppAccount
Obtains the app accounts that can be accessed by the invoker based on the app account owner. This API uses an asynchronous callback to return the result. Obtains the app accounts that can be accessed by the invoker based on the app account owner. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS **Required Permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS
**System capability**: SystemCapability.Account.AppAccount **System capability**: SystemCapability.Account.AppAccount
**Parameters** **Parameters**
...@@ -1212,7 +1183,6 @@ Obtains the app accounts that can be accessed by the invoker based on the app ac ...@@ -1212,7 +1183,6 @@ Obtains the app accounts that can be accessed by the invoker based on the app ac
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.getAccountsByOwner("com.example.accountjsdemo2", (err, data) => { appAccountManager.getAccountsByOwner("com.example.accountjsdemo2", (err, data) => {
if (err) { if (err) {
...@@ -1232,8 +1202,7 @@ getAccountsByOwner(owner: string): Promise<Array<AppAccountInfo>> ...@@ -1232,8 +1202,7 @@ getAccountsByOwner(owner: string): Promise<Array<AppAccountInfo>>
Obtains the app accounts that can be accessed by the invoker based on the app account owner. This API uses a promise to return the result. Obtains the app accounts that can be accessed by the invoker based on the app account owner. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS **Required Permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS
**System capability**: SystemCapability.Account.AppAccount **System capability**: SystemCapability.Account.AppAccount
**Parameters** **Parameters**
...@@ -1259,7 +1228,6 @@ Obtains the app accounts that can be accessed by the invoker based on the app ac ...@@ -1259,7 +1228,6 @@ Obtains the app accounts that can be accessed by the invoker based on the app ac
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.getAccountsByOwner("com.example.accountjsdemo2").then((data) => { appAccountManager.getAccountsByOwner("com.example.accountjsdemo2").then((data) => {
console.debug("getAccountsByOwner successfully, data:" + JSON.stringify(data)); console.debug("getAccountsByOwner successfully, data:" + JSON.stringify(data));
...@@ -1299,7 +1267,6 @@ Subscribes to account information changes of apps. ...@@ -1299,7 +1267,6 @@ Subscribes to account information changes of apps.
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
function changeOnCallback(data){ function changeOnCallback(data){
console.log("receive change data:" + JSON.stringify(data)); console.log("receive change data:" + JSON.stringify(data));
} }
...@@ -1336,8 +1303,7 @@ Unsubscribes from account information changes. ...@@ -1336,8 +1303,7 @@ Unsubscribes from account information changes.
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager(); function changeOnCallback(data) {
function changeOnCallback(data){
console.log("receive change data:" + JSON.stringify(data)); console.log("receive change data:" + JSON.stringify(data));
} }
try{ try{
...@@ -1398,7 +1364,6 @@ Authenticates an app account. This API uses an asynchronous callback to return t ...@@ -1398,7 +1364,6 @@ Authenticates an app account. This API uses an asynchronous callback to return t
}); });
} }
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.auth("LiSi", "com.example.accountjsdemo", "getSocialData", { appAccountManager.auth("LiSi", "com.example.accountjsdemo", "getSocialData", {
onResult: onResultCallback, onResult: onResultCallback,
...@@ -1458,7 +1423,6 @@ Authenticates an app account with customized options. This API uses an asynchron ...@@ -1458,7 +1423,6 @@ Authenticates an app account with customized options. This API uses an asynchron
let options = { let options = {
"password": "xxxx", "password": "xxxx",
}; };
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.auth("LiSi", "com.example.accountjsdemo", "getSocialData", options, { appAccountManager.auth("LiSi", "com.example.accountjsdemo", "getSocialData", options, {
onResult: onResultCallback, onResult: onResultCallback,
...@@ -1498,7 +1462,6 @@ Obtains the authorization token of the specified authentication type for an app ...@@ -1498,7 +1462,6 @@ Obtains the authorization token of the specified authentication type for an app
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.getAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", (err, token) => { appAccountManager.getAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", (err, token) => {
if (err) { if (err) {
...@@ -1546,7 +1509,6 @@ Obtains the authorization token of the specified authentication type for an app ...@@ -1546,7 +1509,6 @@ Obtains the authorization token of the specified authentication type for an app
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.getAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData").then((token) => { appAccountManager.getAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData").then((token) => {
console.log("getAuthToken successfully, token: " + token); console.log("getAuthToken successfully, token: " + token);
...@@ -1587,7 +1549,6 @@ Sets an authorization token of the specific authentication type for an app accou ...@@ -1587,7 +1549,6 @@ Sets an authorization token of the specific authentication type for an app accou
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.setAuthToken("LiSi", "getSocialData", "xxxx", (err) => { appAccountManager.setAuthToken("LiSi", "getSocialData", "xxxx", (err) => {
if (err) { if (err) {
...@@ -1635,7 +1596,6 @@ Sets an authorization token of the specific authentication type for an app accou ...@@ -1635,7 +1596,6 @@ Sets an authorization token of the specific authentication type for an app accou
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.setAuthToken("LiSi", "getSocialData", "xxxx").then(() => { appAccountManager.setAuthToken("LiSi", "getSocialData", "xxxx").then(() => {
console.log("setAuthToken successfully"); console.log("setAuthToken successfully");
...@@ -1677,7 +1637,6 @@ Deletes the authorization token of the specified authentication type for an app ...@@ -1677,7 +1637,6 @@ Deletes the authorization token of the specified authentication type for an app
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.deleteAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx", (err) => { appAccountManager.deleteAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx", (err) => {
if (err) { if (err) {
...@@ -1726,7 +1685,6 @@ Deletes the authorization token of the specified authentication type for an app ...@@ -1726,7 +1685,6 @@ Deletes the authorization token of the specified authentication type for an app
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.deleteAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx").then(() => { appAccountManager.deleteAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx").then(() => {
console.log("deleteAuthToken successfully"); console.log("deleteAuthToken successfully");
...@@ -1770,7 +1728,6 @@ Sets the visibility of an authorization token to an app. This API uses an asynch ...@@ -1770,7 +1728,6 @@ Sets the visibility of an authorization token to an app. This API uses an asynch
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.setAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true, (err) => { appAccountManager.setAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true, (err) => {
if (err) { if (err) {
...@@ -1821,7 +1778,6 @@ Sets the visibility of an authorization token to an app. This API uses a promise ...@@ -1821,7 +1778,6 @@ Sets the visibility of an authorization token to an app. This API uses a promise
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.setAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true).then(() => { appAccountManager.setAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true).then(() => {
console.log("setAuthTokenVisibility successfully"); console.log("setAuthTokenVisibility successfully");
...@@ -1863,7 +1819,6 @@ Checks the visibility of an authorization token of the specified authentication ...@@ -1863,7 +1819,6 @@ Checks the visibility of an authorization token of the specified authentication
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.checkAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", (err, isVisible) => { appAccountManager.checkAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", (err, isVisible) => {
if (err) { if (err) {
...@@ -1912,7 +1867,6 @@ Checks the visibility of an authorization token of the specified authentication ...@@ -1912,7 +1867,6 @@ Checks the visibility of an authorization token of the specified authentication
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.checkAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo").then((isVisible) => { appAccountManager.checkAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo").then((isVisible) => {
console.log("checkAuthTokenVisibility successfully, isVisible: " + isVisible); console.log("checkAuthTokenVisibility successfully, isVisible: " + isVisible);
...@@ -1951,7 +1905,6 @@ Obtains all tokens visible to the invoker for an app account. This API uses an a ...@@ -1951,7 +1905,6 @@ Obtains all tokens visible to the invoker for an app account. This API uses an a
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.getAllAuthTokens("LiSi", "com.example.accountjsdemo", (err, tokenArr) => { appAccountManager.getAllAuthTokens("LiSi", "com.example.accountjsdemo", (err, tokenArr) => {
if (err) { if (err) {
...@@ -1997,7 +1950,6 @@ Obtains all tokens visible to the invoker for an app account. This API uses a pr ...@@ -1997,7 +1950,6 @@ Obtains all tokens visible to the invoker for an app account. This API uses a pr
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.getAllAuthTokens("LiSi", "com.example.accountjsdemo").then((tokenArr) => { appAccountManager.getAllAuthTokens("LiSi", "com.example.accountjsdemo").then((tokenArr) => {
console.log('getAllAuthTokens successfully, tokenArr: ' + JSON.stringify(tokenArr)); console.log('getAllAuthTokens successfully, tokenArr: ' + JSON.stringify(tokenArr));
...@@ -2037,7 +1989,6 @@ Obtains the authorization list of the specified authentication type for an app a ...@@ -2037,7 +1989,6 @@ Obtains the authorization list of the specified authentication type for an app a
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.getAuthList("com.example.accountjsdemo", "getSocialData", (err, authList) => { appAccountManager.getAuthList("com.example.accountjsdemo", "getSocialData", (err, authList) => {
if (err) { if (err) {
...@@ -2084,7 +2035,6 @@ Obtains the authorization list of the specified authentication type for an app a ...@@ -2084,7 +2035,6 @@ Obtains the authorization list of the specified authentication type for an app a
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.getAuthList("com.example.accountjsdemo", "getSocialData").then((authList) => { appAccountManager.getAuthList("com.example.accountjsdemo", "getSocialData").then((authList) => {
console.log("getAuthList successfully, authList: " + authList); console.log("getAuthList successfully, authList: " + authList);
...@@ -2123,7 +2073,6 @@ Obtains the authenticator callback for the authentication session. This API uses ...@@ -2123,7 +2073,6 @@ Obtains the authenticator callback for the authentication session. This API uses
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
let appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant((err, want) => { featureAbility.getWant((err, want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
try { try {
...@@ -2183,7 +2132,6 @@ Obtains the authenticator callback for the authentication session. This API uses ...@@ -2183,7 +2132,6 @@ Obtains the authenticator callback for the authentication session. This API uses
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
let appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant().then((want) => { featureAbility.getWant().then((want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
try { try {
...@@ -2236,7 +2184,6 @@ Obtains the authenticator information of an app. This API uses an asynchronous c ...@@ -2236,7 +2184,6 @@ Obtains the authenticator information of an app. This API uses an asynchronous c
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.queryAuthenticatorInfo("com.example.accountjsdemo", (err, info) => { appAccountManager.queryAuthenticatorInfo("com.example.accountjsdemo", (err, info) => {
if (err) { if (err) {
...@@ -2281,7 +2228,6 @@ Obtains the authenticator information of an app. This API uses a promise to retu ...@@ -2281,7 +2228,6 @@ Obtains the authenticator information of an app. This API uses a promise to retu
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.queryAuthenticatorInfo("com.example.accountjsdemo").then((info) => { appAccountManager.queryAuthenticatorInfo("com.example.accountjsdemo").then((info) => {
console.log("queryAuthenticatorInfo successfully, info: " + JSON.stringify(info)); console.log("queryAuthenticatorInfo successfully, info: " + JSON.stringify(info));
...@@ -2324,7 +2270,6 @@ Checks whether an app account has specific labels. This API uses an asynchronous ...@@ -2324,7 +2270,6 @@ Checks whether an app account has specific labels. This API uses an asynchronous
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
let labels = ["student"]; let labels = ["student"];
try { try {
appAccountManager.checkAccountLabels("zhangsan", "com.example.accountjsdemo", labels, (err, hasAllLabels) => { appAccountManager.checkAccountLabels("zhangsan", "com.example.accountjsdemo", labels, (err, hasAllLabels) => {
...@@ -2375,7 +2320,6 @@ Checks whether an app account has specific labels. This API uses a promise to re ...@@ -2375,7 +2320,6 @@ Checks whether an app account has specific labels. This API uses a promise to re
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
let labels = ["student"]; let labels = ["student"];
try { try {
appAccountManager.checkAccountLabels("zhangsan", "com.example.accountjsdemo", labels).then((hasAllLabels) => { appAccountManager.checkAccountLabels("zhangsan", "com.example.accountjsdemo", labels).then((hasAllLabels) => {
...@@ -2416,7 +2360,6 @@ Deletes the credential of the specified type from an app account. This API uses ...@@ -2416,7 +2360,6 @@ Deletes the credential of the specified type from an app account. This API uses
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.deleteCredential("zhangsan", "PIN_SIX", (err) => { appAccountManager.deleteCredential("zhangsan", "PIN_SIX", (err) => {
if (err) { if (err) {
...@@ -2463,7 +2406,6 @@ Deletes the credential of the specified type from an app account. This API uses ...@@ -2463,7 +2406,6 @@ Deletes the credential of the specified type from an app account. This API uses
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.deleteCredential("zhangsan", "PIN_SIX").then(() => { appAccountManager.deleteCredential("zhangsan", "PIN_SIX").then(() => {
console.log("deleteCredential successfully"); console.log("deleteCredential successfully");
...@@ -2502,7 +2444,6 @@ Selects the accounts that can be accessed by the invoker based on the options. T ...@@ -2502,7 +2444,6 @@ Selects the accounts that can be accessed by the invoker based on the options. T
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
let options = { let options = {
allowedOwners: [ "com.example.accountjsdemo" ], allowedOwners: [ "com.example.accountjsdemo" ],
requiredLabels: [ "student" ] requiredLabels: [ "student" ]
...@@ -2552,7 +2493,6 @@ Selects the accounts that can be accessed by the invoker based on the options. T ...@@ -2552,7 +2493,6 @@ Selects the accounts that can be accessed by the invoker based on the options. T
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
let options = { let options = {
allowedOwners: ["com.example.accountjsdemo"] allowedOwners: ["com.example.accountjsdemo"]
}; };
...@@ -2597,7 +2537,6 @@ Verifies the credential of an app account. This API uses an asynchronous callbac ...@@ -2597,7 +2537,6 @@ Verifies the credential of an app account. This API uses an asynchronous callbac
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.verifyCredential("zhangsan", "com.example.accountjsdemo", { appAccountManager.verifyCredential("zhangsan", "com.example.accountjsdemo", {
onResult: (resultCode, result) => { onResult: (resultCode, result) => {
...@@ -2644,7 +2583,6 @@ Verifies the user credential. This API uses an asynchronous callback to return t ...@@ -2644,7 +2583,6 @@ Verifies the user credential. This API uses an asynchronous callback to return t
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
let options = { let options = {
credentialType: "pin", credentialType: "pin",
credential: "123456" credential: "123456"
...@@ -2692,7 +2630,6 @@ Sets the authenticator attributes of an app. This API uses an asynchronous callb ...@@ -2692,7 +2630,6 @@ Sets the authenticator attributes of an app. This API uses an asynchronous callb
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
try { try {
appAccountManager.setAuthenticatorProperties("com.example.accountjsdemo", { appAccountManager.setAuthenticatorProperties("com.example.accountjsdemo", {
onResult: (resultCode, result) => { onResult: (resultCode, result) => {
...@@ -2737,7 +2674,6 @@ Set authenticator properties. This API uses an asynchronous callback to return t ...@@ -2737,7 +2674,6 @@ Set authenticator properties. This API uses an asynchronous callback to return t
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
let options = { let options = {
properties: {"prop1": "value1"} properties: {"prop1": "value1"}
}; };
...@@ -2780,7 +2716,6 @@ Adds an app account. This API uses an asynchronous callback to return the result ...@@ -2780,7 +2716,6 @@ Adds an app account. This API uses an asynchronous callback to return the result
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("WangWu", (err) => { appAccountManager.addAccount("WangWu", (err) => {
console.log("addAccount err: " + JSON.stringify(err)); console.log("addAccount err: " + JSON.stringify(err));
}); });
...@@ -2809,7 +2744,6 @@ Adds an app account name and additional information. This API uses an asynchrono ...@@ -2809,7 +2744,6 @@ Adds an app account name and additional information. This API uses an asynchrono
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("LiSi", "token101", (err) => { appAccountManager.addAccount("LiSi", "token101", (err) => {
console.log("addAccount err: " + JSON.stringify(err)); console.log("addAccount err: " + JSON.stringify(err));
}); });
...@@ -2843,7 +2777,6 @@ Adds an app account name and additional information. This API uses an asynchrono ...@@ -2843,7 +2777,6 @@ Adds an app account name and additional information. This API uses an asynchrono
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("LiSi", "token101").then(()=> { appAccountManager.addAccount("LiSi", "token101").then(()=> {
console.log('addAccount Success'); console.log('addAccount Success');
}).catch((err) => { }).catch((err) => {
...@@ -2889,7 +2822,6 @@ Adds an app account implicitly based on the specified owner. This API uses an as ...@@ -2889,7 +2822,6 @@ Adds an app account implicitly based on the specified owner. This API uses an as
}); });
} }
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccountImplicitly("com.example.accountjsdemo", "getSocialData", {}, { appAccountManager.addAccountImplicitly("com.example.accountjsdemo", "getSocialData", {}, {
onResult: onResultCallback, onResult: onResultCallback,
onRequestRedirected: onRequestRedirectedCallback onRequestRedirected: onRequestRedirectedCallback
...@@ -2918,7 +2850,6 @@ Deletes an app account. This API uses an asynchronous callback to return the res ...@@ -2918,7 +2850,6 @@ Deletes an app account. This API uses an asynchronous callback to return the res
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteAccount("ZhaoLiu", (err) => { appAccountManager.deleteAccount("ZhaoLiu", (err) => {
console.log("deleteAccount err: " + JSON.stringify(err)); console.log("deleteAccount err: " + JSON.stringify(err));
}); });
...@@ -2951,7 +2882,6 @@ Deletes an app account. This API uses a promise to return the result. ...@@ -2951,7 +2882,6 @@ Deletes an app account. This API uses a promise to return the result.
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteAccount("ZhaoLiu").then(() => { appAccountManager.deleteAccount("ZhaoLiu").then(() => {
console.log('deleteAccount Success'); console.log('deleteAccount Success');
}).catch((err) => { }).catch((err) => {
...@@ -2981,7 +2911,6 @@ Disables an app account from accessing an app. This API uses an asynchronous cal ...@@ -2981,7 +2911,6 @@ Disables an app account from accessing an app. This API uses an asynchronous cal
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.disableAppAccess("ZhangSan", "com.example.accountjsdemo", (err) => { appAccountManager.disableAppAccess("ZhangSan", "com.example.accountjsdemo", (err) => {
console.log("disableAppAccess err: " + JSON.stringify(err)); console.log("disableAppAccess err: " + JSON.stringify(err));
}); });
...@@ -3015,7 +2944,6 @@ Disables an app account from accessing an app. This API uses a promise to return ...@@ -3015,7 +2944,6 @@ Disables an app account from accessing an app. This API uses a promise to return
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.disableAppAccess("ZhangSan", "com.example.accountjsdemo").then(() => { appAccountManager.disableAppAccess("ZhangSan", "com.example.accountjsdemo").then(() => {
console.log('disableAppAccess Success'); console.log('disableAppAccess Success');
}).catch((err) => { }).catch((err) => {
...@@ -3046,7 +2974,6 @@ Enables an app account to access an app. This API uses an asynchronous callback ...@@ -3046,7 +2974,6 @@ Enables an app account to access an app. This API uses an asynchronous callback
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.enableAppAccess("ZhangSan", "com.example.accountjsdemo", (err) => { appAccountManager.enableAppAccess("ZhangSan", "com.example.accountjsdemo", (err) => {
console.log("enableAppAccess: " + JSON.stringify(err)); console.log("enableAppAccess: " + JSON.stringify(err));
}); });
...@@ -3080,7 +3007,6 @@ Enables an app account to access an app. This API uses a promise to return the r ...@@ -3080,7 +3007,6 @@ Enables an app account to access an app. This API uses a promise to return the r
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.enableAppAccess("ZhangSan", "com.example.accountjsdemo").then(() => { appAccountManager.enableAppAccess("ZhangSan", "com.example.accountjsdemo").then(() => {
console.log('enableAppAccess Success'); console.log('enableAppAccess Success');
}).catch((err) => { }).catch((err) => {
...@@ -3112,7 +3038,6 @@ Checks whether data synchronization is enabled for an app account. This API uses ...@@ -3112,7 +3038,6 @@ Checks whether data synchronization is enabled for an app account. This API uses
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkAppAccountSyncEnable("ZhangSan", (err, result) => { appAccountManager.checkAppAccountSyncEnable("ZhangSan", (err, result) => {
console.log("checkAppAccountSyncEnable err: " + JSON.stringify(err)); console.log("checkAppAccountSyncEnable err: " + JSON.stringify(err));
console.log('checkAppAccountSyncEnable result: ' + result); console.log('checkAppAccountSyncEnable result: ' + result);
...@@ -3148,7 +3073,6 @@ Checks whether data synchronization is enabled for an app account. This API uses ...@@ -3148,7 +3073,6 @@ Checks whether data synchronization is enabled for an app account. This API uses
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkAppAccountSyncEnable("ZhangSan").then((data) => { appAccountManager.checkAppAccountSyncEnable("ZhangSan").then((data) => {
console.log('checkAppAccountSyncEnable, result: ' + data); console.log('checkAppAccountSyncEnable, result: ' + data);
}).catch((err) => { }).catch((err) => {
...@@ -3180,7 +3104,6 @@ Set credentials for an app account. This API uses an asynchronous callback to re ...@@ -3180,7 +3104,6 @@ Set credentials for an app account. This API uses an asynchronous callback to re
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001", (err) => { appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001", (err) => {
console.log("setAccountCredential err: " + JSON.stringify(err)); console.log("setAccountCredential err: " + JSON.stringify(err));
}); });
...@@ -3215,7 +3138,6 @@ Set credentials for an app account. This API uses a promise to return the result ...@@ -3215,7 +3138,6 @@ Set credentials for an app account. This API uses a promise to return the result
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001").then(() => { appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001").then(() => {
console.log('setAccountCredential Success'); console.log('setAccountCredential Success');
}).catch((err) => { }).catch((err) => {
...@@ -3247,7 +3169,6 @@ Sets additional information for an app account. This API uses an asynchronous ca ...@@ -3247,7 +3169,6 @@ Sets additional information for an app account. This API uses an asynchronous ca
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002", (err) => { appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002", (err) => {
console.log("setAccountExtraInfo err: " + JSON.stringify(err)); console.log("setAccountExtraInfo err: " + JSON.stringify(err));
}); });
...@@ -3282,7 +3203,6 @@ Sets additional information for an app account. This API uses a promise to retur ...@@ -3282,7 +3203,6 @@ Sets additional information for an app account. This API uses a promise to retur
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002").then(() => { appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002").then(() => {
console.log('setAccountExtraInfo Success'); console.log('setAccountExtraInfo Success');
}).catch((err) => { }).catch((err) => {
...@@ -3315,7 +3235,6 @@ Sets data synchronization for an app account. This API uses an asynchronous call ...@@ -3315,7 +3235,6 @@ Sets data synchronization for an app account. This API uses an asynchronous call
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAppAccountSyncEnable("ZhangSan", true, (err) => { appAccountManager.setAppAccountSyncEnable("ZhangSan", true, (err) => {
console.log("setAppAccountSyncEnable err: " + JSON.stringify(err)); console.log("setAppAccountSyncEnable err: " + JSON.stringify(err));
}); });
...@@ -3351,7 +3270,6 @@ Sets data synchronization for an app account. This API uses a promise to return ...@@ -3351,7 +3270,6 @@ Sets data synchronization for an app account. This API uses a promise to return
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager .setAppAccountSyncEnable("ZhangSan", true).then(() => { appAccountManager .setAppAccountSyncEnable("ZhangSan", true).then(() => {
console.log('setAppAccountSyncEnable Success'); console.log('setAppAccountSyncEnable Success');
}).catch((err) => { }).catch((err) => {
...@@ -3384,7 +3302,6 @@ Sets data to be associated with an app account. This API uses an asynchronous ca ...@@ -3384,7 +3302,6 @@ Sets data to be associated with an app account. This API uses an asynchronous ca
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAssociatedData("ZhangSan", "k001", "v001", (err) => { appAccountManager.setAssociatedData("ZhangSan", "k001", "v001", (err) => {
console.log("setAssociatedData err: " + JSON.stringify(err)); console.log("setAssociatedData err: " + JSON.stringify(err));
}); });
...@@ -3420,7 +3337,6 @@ Sets data to be associated with an app account. This API uses a promise to retur ...@@ -3420,7 +3337,6 @@ Sets data to be associated with an app account. This API uses a promise to retur
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAssociatedData("ZhangSan", "k001", "v001").then(() => { appAccountManager.setAssociatedData("ZhangSan", "k001", "v001").then(() => {
console.log('setAssociatedData Success'); console.log('setAssociatedData Success');
}).catch((err) => { }).catch((err) => {
...@@ -3451,7 +3367,6 @@ Obtains information about all accessible app accounts. This API uses an asynchro ...@@ -3451,7 +3367,6 @@ Obtains information about all accessible app accounts. This API uses an asynchro
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllAccessibleAccounts((err, data)=>{ appAccountManager.getAllAccessibleAccounts((err, data)=>{
console.debug("getAllAccessibleAccounts err:" + JSON.stringify(err)); console.debug("getAllAccessibleAccounts err:" + JSON.stringify(err));
console.debug("getAllAccessibleAccounts data:" + JSON.stringify(data)); console.debug("getAllAccessibleAccounts data:" + JSON.stringify(data));
...@@ -3481,7 +3396,6 @@ Obtains information about all accessible app accounts. This API uses a promise t ...@@ -3481,7 +3396,6 @@ Obtains information about all accessible app accounts. This API uses a promise t
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllAccessibleAccounts().then((data) => { appAccountManager.getAllAccessibleAccounts().then((data) => {
console.log('getAllAccessibleAccounts: ' + data); console.log('getAllAccessibleAccounts: ' + data);
}).catch((err) => { }).catch((err) => {
...@@ -3513,7 +3427,6 @@ Obtains the app accounts that can be accessed by the invoker based on the app ac ...@@ -3513,7 +3427,6 @@ Obtains the app accounts that can be accessed by the invoker based on the app ac
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
const selfBundle = "com.example.actsgetallaaccounts"; const selfBundle = "com.example.actsgetallaaccounts";
appAccountManager.getAllAccounts(selfBundle, (err, data)=>{ appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
console.debug("getAllAccounts err:" + JSON.stringify(err)); console.debug("getAllAccounts err:" + JSON.stringify(err));
...@@ -3550,7 +3463,6 @@ Obtains the app accounts that can be accessed by the invoker based on the app ac ...@@ -3550,7 +3463,6 @@ Obtains the app accounts that can be accessed by the invoker based on the app ac
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
const selfBundle = "com.example.actsgetallaaccounts"; const selfBundle = "com.example.actsgetallaaccounts";
appAccountManager.getAllAccounts(selfBundle).then((data) => { appAccountManager.getAllAccounts(selfBundle).then((data) => {
console.log('getAllAccounts: ' + data); console.log('getAllAccounts: ' + data);
...@@ -3582,7 +3494,6 @@ Obtains the credential of an app account. This API uses an asynchronous callback ...@@ -3582,7 +3494,6 @@ Obtains the credential of an app account. This API uses an asynchronous callback
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountCredential("ZhangSan", "credentialType001", (err, result) => { appAccountManager.getAccountCredential("ZhangSan", "credentialType001", (err, result) => {
console.log("getAccountCredential err: " + JSON.stringify(err)); console.log("getAccountCredential err: " + JSON.stringify(err));
console.log('getAccountCredential result: ' + result); console.log('getAccountCredential result: ' + result);
...@@ -3617,7 +3528,6 @@ Obtains the credential of an app account. This API uses a promise to return the ...@@ -3617,7 +3528,6 @@ Obtains the credential of an app account. This API uses a promise to return the
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountCredential("ZhangSan", "credentialType001").then((data) => { appAccountManager.getAccountCredential("ZhangSan", "credentialType001").then((data) => {
console.log('getAccountCredential, result: ' + data); console.log('getAccountCredential, result: ' + data);
}).catch((err) => { }).catch((err) => {
...@@ -3647,7 +3557,6 @@ Obtains additional information of an app account. Additional information refers ...@@ -3647,7 +3557,6 @@ Obtains additional information of an app account. Additional information refers
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountExtraInfo("ZhangSan", (err, result) => { appAccountManager.getAccountExtraInfo("ZhangSan", (err, result) => {
console.log("getAccountExtraInfo err: " + JSON.stringify(err)); console.log("getAccountExtraInfo err: " + JSON.stringify(err));
console.log('getAccountExtraInfo result: ' + result); console.log('getAccountExtraInfo result: ' + result);
...@@ -3681,7 +3590,6 @@ Obtains additional information of an app account. Additional information refers ...@@ -3681,7 +3590,6 @@ Obtains additional information of an app account. Additional information refers
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountExtraInfo("ZhangSan").then((data) => { appAccountManager.getAccountExtraInfo("ZhangSan").then((data) => {
console.log('getAccountExtraInfo, result: ' + data); console.log('getAccountExtraInfo, result: ' + data);
}).catch((err) => { }).catch((err) => {
...@@ -3712,7 +3620,6 @@ Obtains data associated with an app account. This API uses an asynchronous callb ...@@ -3712,7 +3620,6 @@ Obtains data associated with an app account. This API uses an asynchronous callb
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAssociatedData("ZhangSan", "k001", (err, result) => { appAccountManager.getAssociatedData("ZhangSan", "k001", (err, result) => {
console.log("getAssociatedData err: " + JSON.stringify(err)); console.log("getAssociatedData err: " + JSON.stringify(err));
console.log('getAssociatedData result: ' + result); console.log('getAssociatedData result: ' + result);
...@@ -3747,7 +3654,6 @@ Obtains data associated with an app account. This API uses a promise to return t ...@@ -3747,7 +3654,6 @@ Obtains data associated with an app account. This API uses a promise to return t
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAssociatedData("ZhangSan", "k001").then((data) => { appAccountManager.getAssociatedData("ZhangSan", "k001").then((data) => {
console.log('getAssociatedData: ' + data); console.log('getAssociatedData: ' + data);
}).catch((err) => { }).catch((err) => {
...@@ -3778,7 +3684,6 @@ Subscribes to account information changes of apps. ...@@ -3778,7 +3684,6 @@ Subscribes to account information changes of apps.
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
function changeOnCallback(data){ function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data)); console.debug("receive change data:" + JSON.stringify(data));
} }
...@@ -3812,7 +3717,6 @@ Unsubscribes from account information changes. ...@@ -3812,7 +3717,6 @@ Unsubscribes from account information changes.
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
function changeOnCallback(data){ function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data)); console.debug("receive change data:" + JSON.stringify(data));
appAccountManager.off('change', function(){ appAccountManager.off('change', function(){
...@@ -3866,7 +3770,6 @@ Authenticates an app account with customized options. This API uses an asynchron ...@@ -3866,7 +3770,6 @@ Authenticates an app account with customized options. This API uses an asynchron
}); });
} }
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.authenticate("LiSi", "com.example.accountjsdemo", "getSocialData", {}, { appAccountManager.authenticate("LiSi", "com.example.accountjsdemo", "getSocialData", {}, {
onResult: onResultCallback, onResult: onResultCallback,
onRequestRedirected: onRequestRedirectedCallback onRequestRedirected: onRequestRedirectedCallback
...@@ -3897,7 +3800,6 @@ Obtains the authorization token of the specified authentication type for an app ...@@ -3897,7 +3800,6 @@ Obtains the authorization token of the specified authentication type for an app
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", (err, data) => { appAccountManager.getOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", (err, data) => {
console.log('getOAuthToken err: ' + JSON.stringify(err)); console.log('getOAuthToken err: ' + JSON.stringify(err));
console.log('getOAuthToken token: ' + data); console.log('getOAuthToken token: ' + data);
...@@ -3933,7 +3835,6 @@ Obtains the authorization token of the specified authentication type for an app ...@@ -3933,7 +3835,6 @@ Obtains the authorization token of the specified authentication type for an app
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData").then((data) => { appAccountManager.getOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData").then((data) => {
console.log('getOAuthToken token: ' + data); console.log('getOAuthToken token: ' + data);
}).catch((err) => { }).catch((err) => {
...@@ -3965,7 +3866,6 @@ Sets an authorization token of the specific authentication type for an app accou ...@@ -3965,7 +3866,6 @@ Sets an authorization token of the specific authentication type for an app accou
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthToken("LiSi", "getSocialData", "xxxx", (err) => { appAccountManager.setOAuthToken("LiSi", "getSocialData", "xxxx", (err) => {
console.log('setOAuthToken err: ' + JSON.stringify(err)); console.log('setOAuthToken err: ' + JSON.stringify(err));
}); });
...@@ -4000,7 +3900,6 @@ Sets an authorization token of the specific authentication type for an app accou ...@@ -4000,7 +3900,6 @@ Sets an authorization token of the specific authentication type for an app accou
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthToken("LiSi", "getSocialData", "xxxx").then(() => { appAccountManager.setOAuthToken("LiSi", "getSocialData", "xxxx").then(() => {
console.log('setOAuthToken successfully'); console.log('setOAuthToken successfully');
}).catch((err) => { }).catch((err) => {
...@@ -4033,7 +3932,6 @@ Deletes the authorization token of the specified authentication type for an app ...@@ -4033,7 +3932,6 @@ Deletes the authorization token of the specified authentication type for an app
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx", (err) => { appAccountManager.deleteOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx", (err) => {
console.log('deleteOAuthToken err: ' + JSON.stringify(err)); console.log('deleteOAuthToken err: ' + JSON.stringify(err));
}); });
...@@ -4069,7 +3967,6 @@ Deletes the authorization token of the specified authentication type for an app ...@@ -4069,7 +3967,6 @@ Deletes the authorization token of the specified authentication type for an app
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx").then(() => { appAccountManager.deleteOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx").then(() => {
console.log('deleteOAuthToken successfully'); console.log('deleteOAuthToken successfully');
}).catch((err) => { }).catch((err) => {
...@@ -4102,7 +3999,6 @@ Sets the visibility of an authorization token to an app. This API uses an asynch ...@@ -4102,7 +3999,6 @@ Sets the visibility of an authorization token to an app. This API uses an asynch
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true, (err) => { appAccountManager.setOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true, (err) => {
console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err)); console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err));
}); });
...@@ -4138,7 +4034,6 @@ Sets the visibility of an authorization token to an app. This API uses a promise ...@@ -4138,7 +4034,6 @@ Sets the visibility of an authorization token to an app. This API uses a promise
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true).then(() => { appAccountManager.setOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true).then(() => {
console.log('setOAuthTokenVisibility successfully'); console.log('setOAuthTokenVisibility successfully');
}).catch((err) => { }).catch((err) => {
...@@ -4170,7 +4065,6 @@ Checks the visibility of an authorization token of the specified authentication ...@@ -4170,7 +4065,6 @@ Checks the visibility of an authorization token of the specified authentication
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", (err, data) => { appAccountManager.checkOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", (err, data) => {
console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err)); console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err));
console.log('checkOAuthTokenVisibility isVisible: ' + data); console.log('checkOAuthTokenVisibility isVisible: ' + data);
...@@ -4206,7 +4100,6 @@ Checks the visibility of an authorization token of the specified authentication ...@@ -4206,7 +4100,6 @@ Checks the visibility of an authorization token of the specified authentication
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo").then((data) => { appAccountManager.checkOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo").then((data) => {
console.log('checkOAuthTokenVisibility isVisible: ' + data); console.log('checkOAuthTokenVisibility isVisible: ' + data);
}).catch((err) => { }).catch((err) => {
...@@ -4237,7 +4130,6 @@ Obtains all tokens visible to the invoker for an app account. This API uses an a ...@@ -4237,7 +4130,6 @@ Obtains all tokens visible to the invoker for an app account. This API uses an a
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllOAuthTokens("LiSi", "com.example.accountjsdemo", (err, data) => { appAccountManager.getAllOAuthTokens("LiSi", "com.example.accountjsdemo", (err, data) => {
console.log("getAllOAuthTokens err: " + JSON.stringify(err)); console.log("getAllOAuthTokens err: " + JSON.stringify(err));
console.log('getAllOAuthTokens data: ' + JSON.stringify(data)); console.log('getAllOAuthTokens data: ' + JSON.stringify(data));
...@@ -4272,7 +4164,6 @@ Obtains all tokens visible to the invoker for an app account. This API uses a pr ...@@ -4272,7 +4164,6 @@ Obtains all tokens visible to the invoker for an app account. This API uses a pr
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllOAuthTokens("LiSi", "com.example.accountjsdemo").then((data) => { appAccountManager.getAllOAuthTokens("LiSi", "com.example.accountjsdemo").then((data) => {
console.log('getAllOAuthTokens data: ' + JSON.stringify(data)); console.log('getAllOAuthTokens data: ' + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
...@@ -4303,7 +4194,6 @@ Obtains the authorization list of the specified authentication type for an app a ...@@ -4303,7 +4194,6 @@ Obtains the authorization list of the specified authentication type for an app a
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthList("com.example.accountjsdemo", "getSocialData", (err, data) => { appAccountManager.getOAuthList("com.example.accountjsdemo", "getSocialData", (err, data) => {
console.log('getOAuthList err: ' + JSON.stringify(err)); console.log('getOAuthList err: ' + JSON.stringify(err));
console.log('getOAuthList data: ' + JSON.stringify(data)); console.log('getOAuthList data: ' + JSON.stringify(data));
...@@ -4338,7 +4228,6 @@ Obtains the authorization list of the specified authentication type for an app a ...@@ -4338,7 +4228,6 @@ Obtains the authorization list of the specified authentication type for an app a
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthList("com.example.accountjsdemo", "getSocialData").then((data) => { appAccountManager.getOAuthList("com.example.accountjsdemo", "getSocialData").then((data) => {
console.log('getOAuthList data: ' + JSON.stringify(data)); console.log('getOAuthList data: ' + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
...@@ -4369,7 +4258,6 @@ Obtains the authenticator callback for an authentication session. This API uses ...@@ -4369,7 +4258,6 @@ Obtains the authenticator callback for an authentication session. This API uses
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
let appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant((err, want) => { featureAbility.getWant((err, want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => { appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => {
...@@ -4415,7 +4303,6 @@ Obtains the authenticator callback for an authentication session. This API uses ...@@ -4415,7 +4303,6 @@ Obtains the authenticator callback for an authentication session. This API uses
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
let appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant().then((want) => { featureAbility.getWant().then((want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => { appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
...@@ -4454,7 +4341,6 @@ Obtains the authenticator information of an app. This API uses an asynchronous c ...@@ -4454,7 +4341,6 @@ Obtains the authenticator information of an app. This API uses an asynchronous c
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAuthenticatorInfo("com.example.accountjsdemo", (err, data) => { appAccountManager.getAuthenticatorInfo("com.example.accountjsdemo", (err, data) => {
console.log("getAuthenticatorInfo err: " + JSON.stringify(err)); console.log("getAuthenticatorInfo err: " + JSON.stringify(err));
console.log('getAuthenticatorInfo data: ' + JSON.stringify(data)); console.log('getAuthenticatorInfo data: ' + JSON.stringify(data));
...@@ -4488,7 +4374,6 @@ Obtains the authenticator information of an app. This API uses a promise to retu ...@@ -4488,7 +4374,6 @@ Obtains the authenticator information of an app. This API uses a promise to retu
**Example** **Example**
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAuthenticatorInfo("com.example.accountjsdemo").then((data) => { appAccountManager.getAuthenticatorInfo("com.example.accountjsdemo").then((data) => {
console.log('getAuthenticatorInfo: ' + JSON.stringify(data)); console.log('getAuthenticatorInfo: ' + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
...@@ -4883,7 +4768,7 @@ Creates an app account implicitly based on the specified account owner. This API ...@@ -4883,7 +4768,7 @@ Creates an app account implicitly based on the specified account owner. This API
| options | [CreateAccountImplicitlyOptions](#createaccountimplicitlyoptions9) | Yes | Options for implicitly creating the account. | | options | [CreateAccountImplicitlyOptions](#createaccountimplicitlyoptions9) | Yes | Options for implicitly creating the account. |
| callback | [AuthCallback](#authcallback9) | Yes | Authenticator callback invoked to return the result.| | callback | [AuthCallback](#authcallback9) | Yes | Authenticator callback invoked to return the result.|
### addAccountImplicitly<sup>deprecated</sup> ### addAccountImplicitly<sup>(deprecated)</sup>
addAccountImplicitly(authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void addAccountImplicitly(authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void
...@@ -4922,7 +4807,7 @@ Authenticates an app account to obtain the authorization token. This API uses an ...@@ -4922,7 +4807,7 @@ Authenticates an app account to obtain the authorization token. This API uses an
| options | {[key: string]: Object} | Yes | Options for the authentication. | | options | {[key: string]: Object} | Yes | Options for the authentication. |
| callback | [AuthCallback](#authcallback9) | Yes | Callback invoked to return the result.| | callback | [AuthCallback](#authcallback9) | Yes | Callback invoked to return the result.|
### authenticate<sup>deprecated</sup> ### authenticate<sup>(deprecated)</sup>
authenticate(name: string, authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void authenticate(name: string, authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void
......
...@@ -534,9 +534,9 @@ Allows an application to change the telephone state. ...@@ -534,9 +534,9 @@ Allows an application to change the telephone state.
**Enable ACL**: TRUE **Enable ACL**: TRUE
## ohos.permission.START_ABILIIES_FROM_BACKGROUND ## ohos.permission.START_ABILITIES_FROM_BACKGROUND
Allows an application to start Feature abilities in the background. Allows an application to start or access other components from the background.
**Permission level**: system_basic **Permission level**: system_basic
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册