我试了一下是可以获得 user 对象的 objectId 的
测试代码:
LCUser current = await LCUser.loginByMobilePhoneNumber('15101006007', '112358');
print('user id: ${current.objectId}');
assert(current.objectId != null);
输出日志:
00:01 +0: user login by mobile
*** Request ***
uri: https://ikggdre2.lc-cn-n1-shared.com/1.1/login
method: POST
responseType: ResponseType.json
followRedirects: true
connectTimeout: 0
receiveTimeout: 0
extra: {}
headers:
X-LC-Id: ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz
User-Agent: LeanCloud-Flutter-SDK/0.5.0
content-type: application/json
X-LC-Sign: 36017a043eb7bf6692560d03dcfbae97,1602814319856
data:
{mobilePhoneNumber: 15101006007, password: 112358}
*** Response ***
uri: https://ikggdre2.lc-cn-n1-shared.com/1.1/login
statusCode: 200
headers:
connection: keep-alive
cache-control: no-cache,no-store
date: Fri, 16 Oct 2020 02:11:59 GMT
transfer-encoding: chunked
content-encoding: gzip
vary: Accept-Encoding
strict-transport-security: max-age=31536000
pragma: no-cache
content-type: application/json;charset=utf-8
server: openresty
Response Text:
{"sessionToken":"7f6l5lbatyegve51fqr1qgeti","updatedAt":"2020-07-14T03:50:08.884Z","objectId":"5f0d25a988708a0009449d2b","username":"15101006007","createdAt":"2020-07-14T03:25:29.495Z","emailVerified":false,"mobilePhoneNumber":"15101006007","mobile":"15101006007\n","mobilePhoneVerified":true}
user id: 5f0d25a988708a0009449d2b
如果有问题,可以将请求和应答的日志,以及你获取 objectId 的代码粘贴一下。