我有一个安装了devise_token_auth gem的Rails 5 API项目。我还有一个vue项目,使用jtoker来使Rails api失去知觉。
每次我从vue应用程序发送请求以注册用户时,我都会获得“已完成422无法处理的实体”,这是rails日志:
Started POST "/admin_auth" for 127.0.0.1 at 2018-07-14 17:05:34 -0600
(0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Processing by DeviseTokenAuth::RegistrationsController#create as */*
Parameters: {"email"=>"dbenjaminrdz@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "config_name"=>"admin", "confirm_success_url"=>"http://localhost:8080/register"}
Unpermitted parameter: :config_name
Unpermitted parameter: :config_name
Unpermitted parameter: :config_name
Unpermitted parameter: :config_name
(0.3ms) BEGIN
Admin Exists (1.2ms) SELECT 1 AS one FROM "admins" WHERE "admins"."email" = $1 AND "admins"."provider" = $2 LIMIT $3 [["email", "dbenjaminrdz@gmail.com"], ["provider", "email"], ["LIMIT", 1]]
(0.3ms) ROLLBACK
Completed 422 Unprocessable Entity in 198ms (Views: 0.2ms | ActiveRecord: 4.4ms)
我正在按以下方式使用jtoker:
Auth.emailSignUp({
email: payload.email,
password: payload.password,
password_confirmation: payload.password_confirmation,
config: 'admin'
});
我曾在网上寻找类似的问题,但没有一个解决方案。请帮助我:(