Skip to content
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

Fix Refresh token AbstractController::DoubleRenderError #29

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

xkraty
Copy link
Contributor

@xkraty xkraty commented Aug 21, 2023

In app/controllers/api/devise/tokens_controller.rb#refresh was causing AbstractController::DoubleRenderError when access_token is revoked due to a missing return.

        if current_devise_api_refresh_token.revoked?
          error_response = Devise::Api::Responses::ErrorResponse.new(request, error: :revoked_token,
                                                                              resource_class: resource_class)

          return render json: error_response.body, status: error_response.status
        end

In spec/requests/token_spec.rb some refresh_token tests was passing access_token in headers

      before do
        post refresh_user_tokens_path, headers: authentication_headers_for(user, devise_api_token, :refresh_token), as: :json
      end

@samuelboland
Copy link

I was about to submit a PR to fix this same issue, but found this one already open. It'd be great if this could be merged.

@nejdetkadir nejdetkadir merged commit 7995136 into nejdetkadir:main Oct 23, 2023
@xkraty xkraty deleted the avoid-double-render-error branch October 23, 2023 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants