$factory = (new Factory())->withServiceAccount(env('root_path') . '/config/firebase_credentials.json');
$auth = $factory->createAuth();
try {
$user = $auth->getUser('SQ4SUqp6xZZ9JdoOf7feZuQTeJS2');//根据用户uid查询,其余方法参考文档
res(Enum::HTTP_OK,$user);
} catch (\Kreait\Firebase\Exception\Auth\UserNotFound $e) {
res(Enum::BAD_REQUEST,$e->getMessage());
}
{
"code": 200,
"message": "success",
"data": {//成功返回用户详情
"uid": "SQ4SUqp6xZZ9JdoOf7feZuQTeJS2",
"emailVerified": false,
"disabled": false,
"metadata": {
"createdAt": "2022-06-17T04:08:38+00:00",
"lastLoginAt": "2022-06-17T04:08:38+00:00",
"passwordUpdatedAt": null,
"lastRefreshAt": {
"date": "2022-06-17 04:08:38.952000",
"timezone_type": 3,
"timezone": "UTC"
}
},
"email": null,
"displayName": null,
"photoUrl": null,
"phoneNumber": "+8618611111111",
"providerData": [
{
"uid": "+8618611111111",
"displayName": null,
"screenName": null,
"email": null,
"photoUrl": null,
"providerId": "phone",
"phoneNumber": "+8618611111111"
}
],
"passwordHash": null,
"passwordSalt": null,
"customClaims": [
],
"tokensValidAfterTime": null,
"tenantId": null
},
"status": "success"
}