oapi-sdk-java icon indicating copy to clipboard operation
oapi-sdk-java copied to clipboard

BatchGetIdUserReq通过邮箱获取用户ID时,返回结果user_id字段为空

Open DukeCheung opened this issue 1 year ago • 0 comments

    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();
    }

结果: image

但是通过手机号获取时就可以拿到userId了,我确认账号同时绑定了手机号和邮箱,并且邮箱也是我的个人邮箱。

DukeCheung avatar Sep 15 '24 11:09 DukeCheung