oapi-sdk-java
oapi-sdk-java copied to clipboard
BatchGetIdUserReq通过邮箱获取用户ID时,返回结果user_id字段为空
public static String getUserIdByEmail(String appId, String appSecret, String email) throws Exception {
Client client = Client.newBuilder(appId, appSecret).openBaseUrl(BaseUrlEnum.FeiShu).build();
BatchGetIdUserReq req = new BatchGetIdUserReq();
req.setUserIdType("user_id");
req.setBatchGetIdUserReqBody(BatchGetIdUserReqBody.newBuilder().emails(new String[]{email}).build());
BatchGetIdUserResp resp = client.contact().user().batchGetId(req);
return resp.getData().getUserList()[0].getUserId();
}
结果:
但是通过手机号获取时就可以拿到userId了,我确认账号同时绑定了手机号和邮箱,并且邮箱也是我的个人邮箱。