Open ughstudios opened 4 years ago
For some reason I'm unable to login when using a request from the postman stuff here: https://github.com/heartcombo/devise/wiki/API-Mode-Compatibility-Guide
@Bdoom guessing you aren't sending the Content-Type
and Accept
headers in the assumptions section
@Bdoom, same issue for me (after using this two headers Content-Type and Accept), so i use this guide here : https://github.com/waiting-for-dev/devise-jwt/wiki/Configuring-devise-for-APIs#responding-to-json
Just the first step with the "respond_to :json" directive in the ApplicationController and enjoy ;)
Another tips if you don't want to set the Accept header, you can follow this part of guide https://github.com/waiting-for-dev/devise-jwt/wiki/Configuring-devise-for-APIs#defaulting-to-json-as-format
Finally if you don't want to keep all routes like the GET sessions#new route you can avoid that with :
devise_for :users, skip: :sessions # or skip: :all
devise_scope :user do
post 'users/sign_in' => 'devise/sessions#create', defaults: { format: :json }, :as => 'sign_in_user_session'
delete 'users/sign_out' => 'devise/sessions#destroy', defaults: { format: :json }, :as => 'sign_out_user_session'
end
in your routes.rb file
Will devise ever have support for any frontend frameworks such as emberjs, angular, react, or vue?