1# PermissionRequestResult 2 3The **PermissionRequestResult** module defines the permission request result returned by [requestPermissionsFromUser](js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9). 4 5> **NOTE** 6> 7> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8> - The APIs of this module can be used only in the stage model. 9 10## Properties 11 12**System capability**: SystemCapability.Security.AccessToken 13 14| Name| Type| Read Only| Optional| Description| 15| -------- | -------- | -------- | -------- | -------- | 16| permissions | Array<string> | Yes| No| Permissions requested.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 17| authResults | Array<number> | Yes| No| Result of the permission request.<br>- **-1**: The permission is not granted. If **dialogShownResults** is **true**, it is the first time that the user requests the permission. If **dialogShownResults** is **false**, the permission has been set and no dialog box is displayed. The user can modify the permission settings in **Settings**.<br>- **0**: The permission is granted.<br>- **2**: The permission request is invalid. The possible causes are as follows: 1. The permission is not declared in the configuration file. 2. The permission name is invalid. 3. The conditions for requesting the permission are not met. For details, see [ohos.permission.LOCATION](../../security/AccessToken/permissions-for-all-user.md#ohospermissionlocation) and [ohos.permission.APPROXIMATELY_LOCATION](../../security/AccessToken/permissions-for-all-user.md#ohospermissionapproximately_location).<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 18| dialogShownResults<sup>12+</sup> | Array<boolean> | Yes| Yes| Whether to display a dialog box.<br>The value **true** means to display a dialog box; the value **false** means the opposite.<br>**Atomic service API**: This API can be used in atomic services since API version 12. | 19| errorReasons<sup>18+</sup> | Array<number> | Yes| Yes| Return value.<br>- **0**: The request is valid.<br>- **1**: The permission name is invalid.<br>- **2**: The permission is not declared in the configuration file.<br>- **3**: The conditions for requesting the permission are not met. For details, see the permission description in [Permission List](../../security/AccessToken/permissions-for-all-user.md). Currently, only the location permissions are involved.<br>- **4**: The user does not agree to the privacy statement.<br>- **5**: This permission cannot be requested via a dialog box.<br>- **12**: The service is abnormal.<br>**Atomic service API**: This API can be used in atomic services since API version 18.| 20 21## Usage 22 23The permission request result is obtained through an **atManager** instance. 24 25**Example** 26 27For details about how to obtain the context in the example, see [Obtaining the Context of UIAbility](../../application-models/uiability-usage.md#obtaining-the-context-of-uiability). 28 29```ts 30import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; 31import { BusinessError } from '@ohos.base'; 32import common from '@ohos.app.ability.common'; 33 34let atManager = abilityAccessCtrl.createAtManager(); 35try { 36 let context: Context = this.getUIContext().getHostContext() as common.UIAbilityContext; 37 atManager.requestPermissionsFromUser(context, ["ohos.permission.CAMERA"]).then((data) => { 38 console.info("data:" + JSON.stringify(data)); 39 console.info("data permissions:" + data.permissions); 40 console.info("data authResults:" + data.authResults); 41 console.info("data dialogShownResults:" + data.dialogShownResults); 42 console.info("data errorReasons:" + data.errorReasons); 43 }).catch((err: BusinessError) => { 44 console.error("data:" + JSON.stringify(err)); 45 }) 46} catch(err) { 47 console.error(`catch err->${JSON.stringify(err)}`); 48} 49``` 50