0

I want to put refresh token value in access token. I tried it like following:

public class JwtTokenEnhancer implements TokenEnhancer {
  @Override
  public OAuth2AccessToken enhance(
      OAuth2AccessToken accessToken, OAuth2Authentication authentication) {
    OAuth2RefreshToken refreshToken = accessToken.getRefreshToken();
    Map<String, Object> info = new HashMap<>();
    info.put("my_refresh_token", refreshToken.getValue());
    ((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(info);
    return accessToken;
  }
}

accessToken.getRefreshToken() only get refresh token jti like '860df329-4f44-4d38-9bc7-817b1cda47a2' but not the token encoded value like 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJteV9yZWZyZXNoX3Rva2VuIjoiODYwZGYzMjktNGY0NC00ZDM4LTliYzctODE3YjFjZGE0N2EyIiwidXNlcl9uYW1lIjoicmFuZHkiLCJzY29wZSI6WyJhbGwiXSwiZXhwIjoxNjE1MzQxMjY0LCJhdXRob3JpdGllcyI6WyIxMTAiLCIxMDAiLCIxMTEiLCJST0xFX3N1cGVyQWRtaW4iXSwianRpIjoiOTM0ZjA1MGYtZDU1Yi00NDg3LTkyNDgtNmViM2QzMjIxNTg4IiwiY2xpZW50X2lkIjoid2ViIiwiZW5oYW5jZSI6ImVuaGFuY2UgaW5mbyJ9.gJ_VJx8COMXTMr5usR9uBrZDPvpoocGOTtDB8sWvEy8'

any one knows how to get refresh token encoded value?

xia randy
  • 69
  • 1
  • 7
  • dont store refresh tokens in jwts. Just dont. https://stackoverflow.com/questions/57650692/where-to-store-the-refresh-token-on-the-client – Toerktumlare Mar 10 '21 at 23:49
  • it's indeed not security, I only want to find a way to get access token or refresh token encoded value with jti. – xia randy Mar 12 '21 at 08:03

0 Answers0