在项目中使用外部系统联登报错Unexpected token e in JSON at position 0,然后在插件市场下载最新的uni-im在新的uniCloud空间尝试了一下,还是一样的报错,config.json文件的配置都是默认没有修改,
uni-im配置文件
{
"passwordSecret": "passwordSecret-demo",
"tokenSecret": "passwordSecret-demo",
"requestAuthSecret":"testSecret",
"passwordStrength": "",
"tokenExpiresIn": 2592000,
"tokenExpiresThreshold": 1600,
"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": "微信小程序登录所用的appid、appsecret需要在对应的小程序管理控制台获取",
"appsecret": "微信小程序后台获取的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": ""
}
}
}
uni-id-co 函数运行日志:
请求入参: {
"args": {
"path": "/externalRegister",
"httpMethod": "POST",
"headers": {
"content-length": "66",
"uni-id-signature": "6574615c16140d160fbbbbbfde6f3df45c198da88f78742c304b90aecc47464c",
"uni-id-nonce": "1490298749",
"x-forwarded-for": "172.28.211.100, 100.122.17.21",
"x-real-ip": "121.196.187.230",
"uni-id-timestamp": "1697465349000",
"host": "uni-cloudfunctions.******.cn",
"content-type": "application/json",
"x-forwarded-by": "172.28.195.3:8000",
"cache-control": "no-cache",
"user-agent": "GuzzleHttp/6.5.1 curl/7.70.0 PHP/7.3.31"
},
"queryStringParameters": {},
"isBase64Encoded": false,
"body": "externalUid=92&nickname=%E5%BC%A0%E4%B8%89&avatar=xxxxxxx&gender=0"
},
"requestId": "ac1cc3031697465349425111690"
}
[uni-id-co/ac1cc3031697465349425111690/128ms/ERROR] Unexpected token e in JSON at position 0
SyntaxError: Unexpected token e in JSON at position 0
at parse (null:null:null)
at universal (/tmp/function/common/universal.js:38:32)
at _before (/tmp/function/index.obj.js:99:15)
at c (/tmp/function/__index.js:1:2718)
at exports.main (/tmp/function/__index.js:1:2821)
at Q (/tmp/function/index.js:1:24326)
at z (/tmp/function/index.js:1:25389)
at ae (/tmp/function/index.js:1:26359)
at runUserFunction (/code/index.js:98:229657)
at (<anonymous>)
请求响应状态: fail
小小兵 (作者)
谢谢大佬
2023-10-17 20:38
kacfd
回复 小小兵: 改了哪里大佬
2024-08-09 11:22