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

No route matches [POST] "/sessions" #67

Open
nikunj0407 opened this issue Mar 15, 2016 · 1 comment
Open

No route matches [POST] "/sessions" #67

nikunj0407 opened this issue Mar 15, 2016 · 1 comment

Comments

@nikunj0407
Copy link

Hi,
I am using POSTMAN for making requests to API.
When I request sessions#create for sign_in it throws "No route matches [POST] "/sessions"

Following is the output of rake routes

` ```

 new_user_session GET      /users/sign_in(.:format)               devise/sessions#new
            user_session POST     /users/sign_in(.:format)               devise/sessions#create
    destroy_user_session DELETE   /users/sign_out(.:format)              devise/sessions#destroy
 user_omniauth_authorize GET|POST /users/auth/:provider(.:format)        devise/omniauth_callbacks#passthru {:provider=>/(?!)/}
  user_omniauth_callback GET|POST /users/auth/:action/callback(.:format) devise/omniauth_callbacks#(?-mix:(?!))
           user_password POST     /users/password(.:format)              devise/passwords#create
       new_user_password GET      /users/password/new(.:format)          devise/passwords#new
      edit_user_password GET      /users/password/edit(.:format)         devise/passwords#edit
                         PATCH    /users/password(.:format)              devise/passwords#update
                         PUT      /users/password(.:format)              devise/passwords#update
cancel_user_registration GET      /users/cancel(.:format)                devise/registrations#cancel
       user_registration POST     /users(.:format)                       devise/registrations#create
   new_user_registration GET      /users/sign_up(.:format)               devise/registrations#new
  edit_user_registration GET      /users/edit(.:format)                  devise/registrations#edit
                         PATCH    /users(.:format)                       devise/registrations#update
                         PUT      /users(.:format)                       devise/registrations#update
                         DELETE   /users(.:format)                       devise/registrations#destroy
       user_confirmation POST     /users/confirmation(.:format)          devise/confirmations#create
   new_user_confirmation GET      /users/confirmation/new(.:format)      devise/confirmations#new
                         GET      /users/confirmation(.:format)          devise/confirmations#show
            api_sessions POST     /sessions(.:format)                    api/v1/sessions#create {:format=>:json, :subdomain=>"api"}
             api_session DELETE   /sessions/:id(.:format)                api/v1/sessions#destroy {:format=>:json, :subdomain=>"api"}

As I've added subdomain constraint, I am making the POST request to "api.lvh.me:3000/sessions" with email and password as params.

Let me know where I am doing the mistake.
@kurenn
Copy link
Owner

kurenn commented Mar 15, 2016

Try moving the sessions routes above the devise ones

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

No branches or pull requests

2 participants