first commit
This commit is contained in:
19
uniCloud-aliyun/cloudfunctions/login/index.js
Normal file
19
uniCloud-aliyun/cloudfunctions/login/index.js
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
const db = uniCloud.database()
|
||||
|
||||
exports.main = async (event, context) => {
|
||||
const res = await uniCloud.getPhoneNumber({
|
||||
appid: '__UNI__CA593C1', // 替换成自己开通一键登录的应用的DCloud appid,使用callFunction方式调用时可以不传(会自动取当前客户端的appid),如果使用云函数URL化的方式访问必须传此参数
|
||||
provider: 'univerify',
|
||||
apiKey: '999f511095b875f4e1ac9eb495e4d208', // 在开发者中心开通服务并获取apiKey
|
||||
apiSecret: 'd81d7c58aa11848c687c0970f615c5dc', // 在开发者中心开通服务并获取apiSecret
|
||||
access_token: event.access_token,
|
||||
openid: event.openid
|
||||
});
|
||||
|
||||
console.log(res); // res里的数据格式 { code: 0, success: true, phoneNumber: '186*****078' }
|
||||
|
||||
// 执行入库等操作,正常情况下不要把完整手机号返回给前端
|
||||
return res;
|
||||
};
|
||||
Reference in New Issue
Block a user