larksuite / larksuite/oapi-sdk-java

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

Open
#143 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
310
Forks
115
PR merge metrics
No merged PRs in 30d

Description

    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了,我确认账号同时绑定了手机号和邮箱,并且邮箱也是我的个人邮箱。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the BatchGetIdUserReq setup and the client.contact().user().batchGet(req) call shown in the issue. Compare the email lookup request and response with the working phone-number case, including the user_id type and returned user list. Done means a valid user_id is returned for an email belonging to the account.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.