废话不多说,直接上代码
private String getUserCodeByToken(String token){
String[] chunks = token.split("\\.");
Base64.Decoder decoder = Base64.getUrlDecoder();
String header = new String(decoder.decode(chunks[0]));
String payload = new String(decoder.decode(chunks[1]));
JSONObject userInform= JSON.parseObject(payload);
return userInform.get("xxxx").toString();
}