fsx
(fsx)
1
every time when i use java application to get token (JWT)
and i will receive a string like this
"
i use this string to access https://api.zoom.us/v2/users?page_number=1&page_size=30&status=active
header is
Bearer
it return
{
“code”: 124,
“message”: “The Token’s Signature resulted invalid when verified using the Algorithm: HmacSHA256”
}
who can help me please.
fsx
(fsx)
3
thanks i get it ,I tried many libaries of your provides。the one maven: io.jsonwebtoken / jjwt / 0.9.0
successed。thank u。
1 Like
tommy
(Tommy Gaessler)
4
Glad it is working now!
Let us know if you have additional questions!
-Tommy
jmery24
(Juan Manuel)
5
Hi fsx, can you share the code pls ? Thanks a lot
fsx
(fsx)
6
Map<String,Object> header = new HashMap<>();
header.put(“alg”,“HS256”);
header.put(“type”,“JWT”);
String headerEncode = Base64.getUrlEncoder().encodeToString(header.toString().getBytes());
SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
SecretKey key = Keys.hmacShaKeyFor("".getBytes(StandardCharsets.UTF_8));
String jwt = Jwts.builder().setHeader(header).setIssuer("").
setExpiration(new Date(new Date().getTime()+80000000)).signWith(key,signatureAlgorithm).compact();
System.out.println(headerEncode);
System.out.println(jwt);
2 Likes
jmery24
(Juan Manuel)
7
Great, thank yo very much. Work Perfect !!!
1 Like
tommy
(Tommy Gaessler)
8
Hey @jmery24 happy to hear it worked!
Thanks for your help @fsx!
-Tommy
1 Like
Hi can you share jar you have been used in this code
tommy
(Tommy Gaessler)
10
Hey @mformayank10,
Let us know if there is something we can help with.
Thanks,
Tommy