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

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

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.
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.