"✓", "Authenticity_token" =>...">

Boss Authentication 401

warden.authenticate!(auth_options)

works fine for these parameters:

{"utf8" => "✓", "Authenticity_token" => "5BMAUoZLUEgPZBVOAcQ8lFD4 + pumP9kEvvXyelbnjeO36AZJQt2oRlraicQ6quvh / dccS0ELUkxj" = " username " > " email@mail@mail.ru " xyz "," phone "=>" 9443429932 "}," action "=>" create "," controller "=>" session "," format "=>" json "," session "=> {" user "= > {"email" => " vijay@xyz.com ", "password" => "xyz", "phone" => "9443429932"}}}

but not for this:

{"utf8" => "✓", "Authenticity_token" => "/ ly2phwfsD3HEVkHK39ajYQGv6R4uj2z3B + 3eiZEU0qtp7C92IlIM5KvxY0QEY34KSlZdJ + OtvsBqw0FAcK" "email" => " vijay@xyz.com "}, "action" => "create", "controller" => "session", "format" => "json", "session" => {"user" => {"phone" => "9443429932", "password" => "xyz", "Email" => " vijay@xyz.com "}}}

The data is the same in both cases, except for order. Stuck with this for a long time.

here is the log:

Started POST "/users/sign_in.json" for 127.0.0.1 at 2017-04-10 10:53:07 +0530 Processing with SessionController # create as JSON
Parameters: {"utf8" => "✓", "Authenticity_token" => "XVMbYLTgv4eFbv9pX5lJD3U6DHF17o18rVIjqQLo4skOqB17cHZHidDQY + Nk95562BXqoZLaBjRwp / nWJW43KA ==", "user" => {"phone" = "=>" ">" FILTER} {"phone" => "9443429932", "password" => "[FILTERED]"}}} User Load (0.3ms) SELECT users

. * FROM users

WHERE users

. id

= 12422916 AND (current_ prompt) LIMIT 1 Completed 401 Unauthorized after 15 ms

+3


source to share


1 answer


Problem detected. the caretaker reads parameters from request.params I edited the parameters, but it was not reflected in request.params.



Request.Params [: user] .merge (PARAMS [: user])! This fixed the problem.

+2


source







All Articles