larksuite / larksuite/oapi-sdk-java

获取token,参数值错误,直接抛异常,而且异常信息不是json,如何解析code值,代码如下

Open
#82 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

Map<String, Object> appAccessTokenBody = new HashMap<>();
appAccessTokenBody.put("app_id", Constant.FeiSuOpenAiAppId);
appAccessTokenBody.put("app_secret", Constant.FeiSuOpenAiAppSecret);

    try {
        RawResponse resp = getClient().post(Constant.FeiShuAppAccessToken, appAccessTokenBody, AccessTokenType.Tenant);

        // 处理结果
        System.out.println(resp.getStatusCode());
        System.out.println(Jsons.DEFAULT.toJson(resp.getHeaders()));
        System.out.println(new String(resp.getBody()));
        System.out.println(resp.getRequestID());
    } catch (Exception e) {
        e.printStackTrace();
    }

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 getClient().post call and the exception path shown in the issue, then inspect how invalid app_id or app_secret responses are represented by RawResponse. Reproduce the request with invalid credentials and compare the status code, body, headers, and request ID. Done means the SDK's handling of the error code and non-JSON exception response is clearly understood or documented.

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
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.