授权
最后更新于:2022-04-02 03:40:09
[TOC]
## 概述
格式
```
uni.authorize(OBJECT)
```
scope 列表
| scope | 对应接口 | 描述 | 平台差异说明 |
| --- | --- | --- | --- |
| scope.userInfo | [uni.getUserInfo](https://uniapp.dcloud.net.cn/api/plugins/login?id=getuserinfo) | 用户信息 | |
| scope.userLocation | [uni.getLocation](https://uniapp.dcloud.net.cn/api/location/location?id=getlocation),[uni.chooseLocation](https://uniapp.dcloud.net.cn/api/location/location?id=chooselocation) | 地理位置 | |
| scope.userLocationBackground | wx.userLocationBackground | 后台定位 | 微信小程序 |
| scope.address | [uni.chooseAddress](https://uniapp.dcloud.net.cn/api/other/choose-address) | 通信地址 | |
| scope.record | [uni.getRecorderManager](https://uniapp.dcloud.net.cn/api/media/record-manager?id=getrecordermanager) | 录音功能 | |
| scope.writePhotosAlbum | [uni.saveImageToPhotosAlbum](https://uniapp.dcloud.net.cn/api/media/image?id=saveimagetophotosalbum),[uni.saveVideoToPhotosAlbum](https://uniapp.dcloud.net.cn/api/media/video?id=savevideotophotosalbum) | 保存到相册 | 字节跳动小程序的返回值是scope.album |
| scope.camera | [` `](https://uniapp.dcloud.net.cn/component/camera)组件,头条下的扫码、拍照、选择相册 | 摄像头 | |
| scope.invoice | [wx.chooseInvoice](https://developers.weixin.qq.com/miniprogram/dev/api/wx.chooseInvoice.html) | 获取发票 | 微信小程序、QQ小程序 |
| scope.invoiceTitle | [uni.chooseInvoiceTitle](https://uniapp.dcloud.net.cn/api/other/invoice-title) | 发票抬头 | 微信小程序、百度小程序、QQ小程序 |
| scope.werun | [wx.getWeRunData](https://developers.weixin.qq.com/miniprogram/dev/api/wx.getWeRunData.html) | 微信运动步数 | 微信小程序 |
示例
```
uni.authorize({
scope: 'scope.userLocation',
success() {
uni.getLocation()
}
})
```
';