配置文件
{
"passwordSecret": "passwordSecret",
"tokenSecret": "tokenSecret",
"requestAuthSecret": "testSecret", // URL化请求鉴权签名密钥
"tokenExpiresIn": 7200,
"tokenExpiresThreshold": 600,
"passwordErrorLimit": 6,
"bindTokenToDevice": false,
"passwordErrorRetryTime": 3600,
"autoSetInviteCode": false,
"forceInviteCode": false,
"preferedAppPlatform": "app",
"app": {
"tokenExpiresIn": 2592000,
"oauth": {
"weixin": {
"appid": "填写来源微信开放平台https://open.weixin.qq.com/创建的应用的appid",
"appsecret": "填写来源微信开放平台https://open.weixin.qq.com/创建的应用的appsecret"
},
"apple": {
"bundleId": "苹果开发者后台获取的bundleId"
}
}
},
"web": {
"oauth": {
"h5-weixin": {
"appid": "微信浏览器内微信登录,所用的微信公众号appid",
"appsecret": "微信公众号后台获取的appsecret"
},
"web-weixin": {
"appid": "手机微信扫码登录,所用的微信开放平台(https://open.weixin.qq.com/)-网站应用的appid",
"appsecret": "微信开放平台-网站应用的appsecret"
}
}
},
"mp-weixin": {
"oauth": {
"weixin": {
"appid": "",
"appsecret": ""
}
}
},
"mp-alipay": {
"oauth": {
"alipay": {
"appid": "支付宝小程序登录用到的appid、privateKey请参考支付宝小程序的文档进行设置或者获取,https://opendocs.alipay.com/open/291/105971#LDsXr",
"privateKey": "支付宝小程序登录用到的appid、privateKey请参考支付宝小程序的文档进行设置或者获取,https://opendocs.alipay.com/open/291/105971#LDsXr"
}
}
},
"service": {
"sms": {
"name": "应用名称,对应短信模版的name",
"codeExpiresIn": 300,
"smsKey": "短信密钥key,开通短信服务处可以看到",
"smsSecret": "短信密钥secret,开通短信服务处可以看到"
},
"univerify": {
"appid": "当前应用的appid,使用云函数URL化,此项必须配置",
"apiKey": "apiKey 和 apiSecret 在开发者中心获取,开发者中心:https://dev.dcloud.net.cn/uniLogin/index?type=0,文档:https://ask.dcloud.net.cn/article/37965",
"apiSecret": ""
}
}
}
1***@qq.com
- 发布:2023-11-01 10:31
- 更新:2024-09-23 14:55
- 阅读:401
4 个回复
1***@qq.com (作者)
DCloud_uniCloud_WYQ
看下是不是uni-id的配置里面带了注释
1***@qq.com (作者)
请问URL化请求鉴权签名 报错 uni-id-illegal-request 这个怎么解决
2023-11-01 11:17
1***@qq.com (作者)
class Sign {
constructor(requestAuthSecret) {
this.requestAuthSecret = requestAuthSecret
}
getSignature(params, nonce, timestamp) {
const paramsStr = this.getParamsString(params)
const signature = CryptoJS.HmacSHA256(
${this.requestAuthSecret}${nonce}
,${timestamp}${paramsStr}
).toString(CryptoJS.enc.Hex)
}
getParamsString(params) {
return Object.keys(params)
.sort()
.filter(item => typeof params[item] !== 'object')
.map(item =>
${item}=${params[item]}
).join('&')
}
}
2023-11-01 11:18
1***@163.com - 暂无简介
如果修改过 'uni-config-center' 文件
把对应的 config.json 中的注释去掉即可
1***@qq.com
没有注释了还是错误
Error: [UserId]: Invalid uni-id config file
/tmp/function/@common_modules/uni-config-center/uni-id/config.json: Unexpected token / in JSON at position 182