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

Unpermitted parameter: {"email":"mail@gmail.com","password":"abcdefgh","password_confirmation":"abcdefgh"} #587

Closed
dsmegha opened this issue Mar 28, 2016 · 7 comments

Comments

@dsmegha
Copy link

dsmegha commented Mar 28, 2016

Hi,
I am new to rails and web-app development. I am trying to get the devise_auth_token working and am using HTTParty to test this.

My rake routes contains this line :
user_registration POST /auth(.:format) devise_token_auth/registrations#create

And my HTTParty request is like this :

HTTParty.post("http://localhost:3000/auth/", {:body => [{:email => "mail@gmail.com", :password => "abcdefgh", :password_confirmation => "abcdefgh"}].to_json})

But I am getting this error :

Processing by DeviseTokenAuth::RegistrationsController#create as /
Parameters: {"{"email":"mail@gmail.com","password":"abcdefgh","password_confirmation":"abcdefgh"}"=>"[FILTERED]"}
Unpermitted parameter: {"email":"mail@gmail.com","password":"abcdefgh","password_confirmation":"abcdefgh"}
Filter chain halted as :validate_sign_up_params rendered or redirected

Why am I getting this?

@thelastinuit
Copy link

@dsmegha
Can you please let me know what version of ruby, rails and devise_auth_token you are running?
Also, paste your appliacation_controller.rb, please.

@dsmegha
Copy link
Author

dsmegha commented Apr 5, 2016

Hi @thelastinuit , thanks a lot. I got it working now.

@dsmegha dsmegha closed this as completed Apr 5, 2016
@poc7667
Copy link

poc7667 commented Apr 22, 2016

@dsmegha Hi How could you fix it? thanks

@dsmegha
Copy link
Author

dsmegha commented Apr 22, 2016

There was something wrong with the way I was passing my arguments.

It worked with this :
response = HTTParty.post("http://localhost:3000/api/v1/auth/", :body => {"email" => "mail@gmail.com", "password" => "abcdefgh", "password_confirmation" => "abcdefgh"})

@poc7667
Copy link

poc7667 commented Apr 23, 2016

Gotcha, did you use ng-token-auth? I got the 401 for the subsequent request after successful login
http://stackoverflow.com/questions/36806116/after-successful-sign-in-the-followingsubsequents-requests-in-angular-side-ar

@dsmegha
Copy link
Author

dsmegha commented Apr 24, 2016

Did you get it to work? I did not use ng-token-auth. I tested using basic
curl.

$ curl -s -D - -H 'Content-Type: application/json' -H 'Accept:
application/json' -X POST
http://dsmegha-expenses.herokuapp.com/api/v1/auth/sign_in -d '{"email": "
user1@mail.com", "password": "password1"}'
HTTP/1.1 200 OK
Connection: keep-alive
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Access-Token: mMVoKz6eEnDAahhAx3d7mA
Token-Type: Bearer
Client: GKyqZgszIhG4ei9w5stbRw
Expiry: 1462721069
Uid: user1@mail.com
Content-Type: application/json; charset=utf-8
Etag: W/"1cbd762cd217d0a0a0963718a25a1b54"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 44d7ba8b-f912-4c63-9bac-1abb90953796
X-Runtime: 0.268134
Server: WEBrick/1.3.1 (Ruby/2.2.4/2015-12-16)
Date: Sun, 24 Apr 2016 15:24:29 GMT
Content-Length: 114
Via: 1.1 vegur

The subsequent request would send the client, uid and Access-Token.

$ curl -s -D - -H 'Content-Type: application/json' -H 'Accept:
application/json' -H 'Client: GKyqZgszIhG4ei9w5stbRw' -H 'Uid:
user1@mail.com' -H 'Access-Token: mMVoKz6eEnDAahhAx3d7mA' -X GET
http://dsmegha-expenses.herokuapp.com/api/v1/users/7/expenses
HTTP/1.1 200 OK
Connection: keep-alive
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Access-Token: UJAQT2PYJlV_LnVheJqfGw
Token-Type: Bearer
Client: GKyqZgszIhG4ei9w5stbRw
Expiry: 1462721175
Uid: user1@mail.com
Content-Type: application/json; charset=utf-8
Etag: W/"bb7c830cd4d7f25cab748ba255516dde"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: d7d4297a-7dfd-4dd3-ab29-e33793a9fa87
X-Runtime: 0.152200
Server: WEBrick/1.3.1 (Ruby/2.2.4/2015-12-16)
Date: Sun, 24 Apr 2016 15:26:15 GMT
Content-Length: 148
Set-Cookie:
_dsmegha-expenses_session=TCtBWG9BOFdsUzNZSm8ralhhWTNmcjhIRGpNUUxGQzJiSWJCbWd2cnpxaTNWVUEvN3hHU1IvMjFaR0wzL0RnVDlHbXFDdms2UnI1OStEK1k2S2o4RTUrU0lxU3ZmZW1yUklzd0RqOW9ORmlUWUFHVit2Vk5xS1ptUVQ0OXpJaEx5NWNTVGxhVUQzTk9HVzdJVUFWampRPT0tLWhmMTZEeTZEMWRya1h1aE5NUHd3a3c9PQ%3D%3D--5878c6a4ce483c201c44401333a84b6ab76b1a49;
path=/; HttpOnly
Via: 1.1 vegur

On Sat, Apr 23, 2016 at 8:25 AM, Poc notifications@github.com wrote:

Gotcha, did you use ng-token-auth? I got the 401 for the subsequent
request after successful login

http://stackoverflow.com/questions/36806116/after-successful-sign-in-the-followingsubsequents-requests-in-angular-side-ar


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#587 (comment)

@poc7667
Copy link

poc7667 commented Apr 25, 2016

Hey, thank you so much, it worked, the problem was that I didn't use the latest version gem LOL

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

3 participants