Sha256: bec7e4b4b7978dcf25391332f1913df5a7a8528b97ac772a7b4a98a6c4ba6d66
Contents?: true
Size: 1.03 KB
Versions: 6
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true module DeviseJwtAuth class RefreshTokenController < DeviseJwtAuth::ApplicationController before_action :set_user_by_refresh_token def show if @resource yield @resource if block_given? render_refresh_token_success else render_refresh_token_error end end protected def resource_data response_data = @resource.as_json response_data['type'] = @resource.class.name.parameterize if json_api? response_data end def render_refresh_token_success response_data = { status: 'success', data: resource_data } response_data.merge!(@resource.create_named_token_pair) if active_for_authentication? render json: response_data end def render_refresh_token_error render_error(401, I18n.t('devise_jwt_auth.token_validations.invalid')) end def active_for_authentication? !@resource.respond_to?(:active_for_authentication?) || @resource.active_for_authentication? end end end
Version data entries
6 entries across 6 versions & 1 rubygems