Skip to content

Feature/customable authorized users only error response #869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6 changes: 3 additions & 3 deletions lib/devise_token_auth/controllers/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def current_#{group_name.to_s.pluralize}

def render_authenticate_#{group_name}_error
return render json: {
errors: ["Authorized #{group_name} only."]
errors: [I18n.t('devise.failure.unauthenticated')]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have resolved conflict about error message.

}, status: 401
end

Expand Down Expand Up @@ -131,10 +131,10 @@ def current_#{mapping}
def #{mapping}_session
current_#{mapping} && warden.session(:#{mapping})
end

def render_authenticate_#{mapping}_error
return render json: {
errors: ["Authorized #{mapping} only."]
errors: [I18n.t('devise.failure.unauthenticated')]
}, status: 401
end
METHODS
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.