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

auth.emailSignUp(...) API call sends unnecessary confirm_success_url param #32

Open
Aerlinger opened this issue Mar 11, 2017 · 2 comments

Comments

@Aerlinger
Copy link

In Rails this will trigger an UnpermittedParameters exception on the backend:

Here's the code to reproduce:

$.auth.emailSignUp({
      email: email,
      password: password,
      password_confirmation: password
    }).then(function (res) {
      console.log("SUCCESS", res)
    }).fail(function (err) {
      console.log("FAIL", err)
    });

params sent in POST request

email:jtokertest@test.com
password:iamsecret
password_confirmation:iamsecret
confirm_success_url:http://127.0.0.1:5000/

Exception on backend:

ActionController::UnpermittedParameters (found unpermitted parameter: confirm_success_url):

actionpack (5.0.2) lib/action_controller/metal/strong_parameters.rb:733:in `unpermitted_parameters!'
actionpack (5.0.2) lib/action_controller/metal/strong_parameters.rb:397:in `permit'
devise_token_auth (0.1.40) app/controllers/devise_token_auth/registrations_controller.rb:101:in `sign_up_params'
devise_token_auth (0.1.40) app/controllers/devise_token_auth/registrations_controller.rb:199:in `validate_sign_up_params'

Obviously, it's possible to whitelist the confirm_success_url param, but does it need to be there in the first place?

@hughkolias
Copy link

It's sent because devise_token_auth requires the confirm_success_url param (see https://github.com/lynndylanhurley/devise_token_auth#initializer-settings).

Maybe we could make it over-ridable in jquery.j-toker.js (it's being set at line 652 [opts.confirm_success_url = config.confirmationSuccessUrl();]), and let people set the confirm_success_url in the devise_token_auth initializer instead of whitelisting the param?

Not sure if people would find this useful though?

@moyuanhuang
Copy link

moyuanhuang commented Oct 2, 2018

devise_token_auth v0.2.0 is said to have this issue. I was able to get rid of it by reverting the version to 0.1.43.

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