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

302 found when I try to redirect to "/devise_token_auth/sessions#create" #790

Closed
alex3o0 opened this issue Dec 14, 2016 · 2 comments
Closed

Comments

@alex3o0
Copy link

alex3o0 commented Dec 14, 2016

I'm trying to add another way to sign in to my application wich can use te original sign_in method, catch the result and then do more validations after return the request.

I try something like this:

class AnotherController < ApplicationController
  def sign_in_2
    redirect_to '/devise_token_auth/sessions#create' do |x|
      # make validations with values in  x
    end
  end 
end 

this trhow me an '302 found'

@alex3o0
Copy link
Author

alex3o0 commented Dec 15, 2016

Ok, also try to ihnerits from DeviseTokenAuth::SessionsController and overrides the create method but now I get this message error when I try to acces via post 'another/sign_in_2' => 'another#create'

[Devise] Could not find devise mapping for path "/another/sign_in_2".
This may happen for two reasons:

1) You forgot to wrap your route inside the scope block. For example:

  devise_scope :user do
    get "/some/route" => "some_devise_controller"
  end

2) You are testing a Devise controller bypassing the router.
   If so, you can explicitly tell Devise which mapping to use:

   @request.env["devise.mapping"] = Devise.mappings[:user]


Completed 404 Not Found in 2ms (ActiveRecord: 0.6ms)

@zachfeldman
Copy link
Contributor

Hi there @alex3o0 ,

In an effort to cleanup this project and prioritize a bit, we're marking issues that haven't had any activity in a while with a "close-in-7-days" label. If we don't hear from you in about a week, we'll be closing this issue. Obviously feel free to re-open it at any time if it's the right time or this was done in error!

If you are still having the issue (especially if it's a bug report) please refer to our new Issue Template to provide some more details to help us solve it.

Hope all is well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants