Class: DeviseTokenAuth::TokenValidationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/devise_token_auth/token_validations_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#resource_class

Instance Method Details

#validate_token ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/devise_token_auth/token_validations_controller.rb', line 6

def validate_token
  # @resource will have been set by set_user_token concern
  if @resource
    render json: {
      success: true,
      data: @resource.token_validation_response
    }
  else
    render json: {
      success: false,
      errors: ["Invalid login credentials"]
    }, status: 401
  end
end