<commit_before>class Api::JwtsController < Api::ApiApplicationController

  def show
    token = AuthToken.issue_token({ user_id: current_user.id })
    respond_to do |format|
      format.json { render json: { jwt: token } }
    end
  end

end<commit_msg>Refresh JWT with existing jwt data When a JWT is refreshed, we currently loose all the custom data that was added to it. This fixes it so all existing data is kept in the refreshed JWT.<commit_after>class Api::JwtsController < Api::ApiApplicationController

  def show
    old_token_attrs = decoded_jwt_token(request)&.except("iat", "exp", "aud")
    token = AuthToken.issue_token(old_token_attrs)
    respond_to do |format|
      format.json { render json: { jwt: token } }
    end
  end

end
{'fraction_non_alphanumeric': 0.08544726301735647, 'fraction_numerical': 0.0, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2256399', 'n_tokens_mistral': 232, 'n_tokens_neox': 231, 'n_words': 76}