ruby - Change response required for Rails authentication -


i've user model , login route. using ember-simple-auth, whenever i'm sending data authentication, data required in format:

{"password"=>"[filtered]", "email"=>"admin@admin.com"}

however, want data in format:

{"user"=>{"password"=>"[filtered]", "email"=>"admin@admin.com"}}

how can change this? thanks. code: https://github.com/ghoshnirmalya/hub-server

as possible approach can override resoure_params method

class api::v1::sessionscontroller < devisetokenauth::sessionscontroller    private    def resource_params     params.permit(user: params_for_resource(:sign_in))[:user]   end end 

routes

namespace "api"   namespace "v1"     mount_devise_token_auth_for 'user', at: 'auth', controllers: {       sessions:  'api/v1/sessions'     }     resources :users   end end 

then if params looks like

{      "user": {         "email": "nirmalya.email@gmail.com",         "password":"password"     } } 

you receive success response:

{     "data": {         "id": 1,         "provider": "email",         "uid": "nirmalya.email@gmail.com",         "name": "nirmalya ghosh",         "nickname": null,         "image": null,         "email": "nirmalya.email@gmail.com"     } } 

but i'm strongly recommend refactor frontend meet devise_token_auth reqirements , pass params {email: "foo@mail.com", password: "password"}