coze-dev / coze-dev/coze-java

示例JWTOAuthExample 运行抛异常

Open
#147 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
214
Forks
98
PR merge metrics
No merged PRs in 30d

Description


com.coze
coze-api
0.4.2

按照github的示例运行,在以下部分抛出异常
`
try {
OAuthToken resp = oauth.getAccessToken();
System.out.println(resp);
} catch (Exception e) {
e.printStackTrace();
}
`
Exception in thread "main" java.lang.NoSuchMethodError: 'io.jsonwebtoken.JwtBuilder io.jsonwebtoken.JwtBuilder.signWith(java.security.Key, io.jsonwebtoken.SignatureAlgorithm)'
at com.coze.openapi.service.auth.DefaultJWTBuilder.generateJWT(DefaultJWTBuilder.java:25)
at com.coze.openapi.service.auth.JWTOAuthClient.doGetAccessToken(JWTOAuthClient.java:114)
at com.coze.openapi.service.auth.JWTOAuthClient.getAccessToken(JWTOAuthClient.java:52)
at com.fx.ai.coze.JWTOAuthExample.main(JWTOAuthExample.java:73)

Contributor guide

Open the contributing guide

Research direction

Start with the dependency declaration for coze-api 0.4.2 and inspect the resolved JWT dependencies, then read com.coze.openapi.service.auth.DefaultJWTBuilder.java at line 25. Run com.fx.ai.coze.JWTOAuthExample and verify that the OAuth token request completes without the reported NoSuchMethodError.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.