Gets the user's authorization status for the current miniapp. Use with wv.authorize.
Request parameters
|
Parameter |
Type |
Required |
Description |
|
success |
Function |
No |
Callback on success. |
|
fail |
Function |
No |
Callback on failure. |
Response parameters
The success callback receives an object with the user's authorization settings.
|
Parameter |
Type |
Description |
|
authSetting |
Object |
Authorization results. Keys are permission scopes; boolean values indicate whether each permission is granted. |
Properties of authSetting:
|
Parameter |
Type |
Description |
|
location |
Boolean |
Authorization status for location. |
|
camera |
Boolean |
Authorization status for camera. |
|
bluetooth |
Boolean |
Authorization status for Bluetooth. |
|
album |
Boolean |
Authorization status for album. |
|
contacts |
Boolean |
Authorization status for contacts. |
|
microphone |
Boolean |
Authorization status for microphone. |
|
file |
Boolean |
Authorization status for file access. |
|
call |
Boolean |
Authorization status for calls. |
|
vibrate |
Boolean |
Authorization status for vibration. |
|
screen |
Boolean |
Authorization status for screen capture. |
On failure, the fail callback receives an object with error details.
|
Error message |
Description |
Solution |
|
You need to configure the authorization switch to apply for authorization |
Authorization switch not enabled. |
Configure the authorization switch during container initialization. |
|
User not bound |
User ID not registered with the container. |
Pass the user ID when registering the user with the container. |
Sample code
window.WindVane.call('wv', 'getSetting', {}, function(res) {
const { camera = false, location = false } = res.authSetting;
}, function(e) {
alert('failure:' + JSON.stringify(e));
});