1. 初始化uni-starter项目之后需要在uniCloud–>cloudfunctions–>common–>uni-config-center下面新增uni-id文件夹,下面新增config.json文件。
1.1配置好tokenSecret和微信的appId,appSecret等,如下:
{"passwordSecret": [{"type": "hmac-sha256","version": 1}], "passwordStrength": "medium", "tokenSecret": "sdfsfdf", "requestAuthSecret": "", "tokenExpiresIn": 7200, "tokenExpiresThreshold": 3600, "maxTokenLength": 10, "passwordErrorLimit": 6, "passwordErrorRetryTime": 3600, "autoSetInviteCode": false, "forceInviteCode": false, "idCardCertifyLimit": 1, "realNameCertifyLimit": 5, "sensitiveInfoEncryptSecret": "", "frvNeedAlivePhoto": false, "userRegisterDefaultRole": [], "app": { "tokenExpiresIn": 2592000,"tokenExpiresThreshold": 864000,"oauth": {"weixin": {"appid": "","appsecret": ""},"qq": {"appid": "","appsecret": ""},"apple": { "bundleId": ""}}},"web": { "tokenExpiresIn": 7200,"tokenExpiresThreshold": 3600,"oauth": {"weixin-h5": { "appid": "","appsecret": ""},"weixin-web": { "appid": "","appsecret": ""}}},"mp-weixin": {"tokenExpiresIn": 259200,"tokenExpiresThreshold": 86400,"oauth": {"weixin": {"appid": "wdfdfxdf1d7bb8df156f844ec","appsecret": "f1b0bcfdf8d0e6edfd3dca63dfdf71fb5a00025e78"}}},"mp-qq": {"tokenExpiresIn": 259200,"tokenExpiresThreshold": 86400,"oauth": {"qq": {"appid": "","appsecret": ""}}},"mp-alipay": {"tokenExpiresIn": 259200,"tokenExpiresThreshold": 86400,"oauth": {"alipay": {"appid": "","privateKey": "", "keyType": "PKCS8" }}},"service": {"sms": {"name": "", "codeExpiresIn": 180, "scene": {"bind-mobile-by-sms": { "templateId": "", "codeExpiresIn": 240 }}},"univerify": {"appid": ""}}
}
uni-admin似乎无法直接关联到uni-starter的服务空间,会一直提示需要初始化数据库,所以选择在同一个服务空间初始化数据库后再让uni-admin关联到uni-starter的服务空间下,这样貌似才能够同步用户数据。
但是有个问题:这样的话uni-starter的schema2code就没法生成到uni-admin中,这样的话也只能复制粘贴过去了,应该是个bug。
202404111243
最新的一次,直接先下载的uni-starter,然后关联到云空间,初始化database,将数据库这些上传到了云空间,新建了uni-id文件夹及其config.json。然后再下载的uni-admin模板,直接将uniCloud关联到了uni-starter服务空间,并且移动至关联项目下
,这样运行uni-admin竟然没有报任何错误,新建账号也可以和uni-starter互通。