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

ArgumentError in DeviseTokenAuth::ConfirmationsController#show #339

Closed
legolytics opened this issue Aug 16, 2015 · 3 comments
Closed

ArgumentError in DeviseTokenAuth::ConfirmationsController#show #339

legolytics opened this issue Aug 16, 2015 · 3 comments

Comments

@legolytics
Copy link

We have rails backend and backbone on the front-end. I am trying to use devise_token_auth to work with devise user authentications with tokens.

I have a form on the backbone for new user registration. I am creating a new record in User model and some other records and setting up proper relationships between users and internal objects such as organization etc..

Now users are getting confirmation email. When they click on the link, actual confirmation was successful on the rails side, but I am getting the following error on the backbone side.

I set the following in devise_token_auth.rb initializer file thinking that it needs confirm_succes_url, but it did not help.

  config.default_confirm_success_url = "http://medl.io"

confirmation url looks like this.

http://localhost:4000/auth/confirmation?config=&confirmation_token=ribwBQNszgcxRgrx-6w9
bad argument (expected URI object or URI string)

/Users/medlio/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/uri/common.rb:1234:in `URI'
/Users/medlio/.rvm/gems/ruby-2.1.2/bundler/gems/devise_token_auth-47e8848cf124/lib/devise_token_auth/url.rb:4:in `generate'
/Users/medlio/.rvm/gems/ruby-2.1.2/bundler/gems/devise_token_auth-47e8848cf124/app/models/devise_token_auth/concerns/user.rb:201:in `build_auth_url'
/Users/medlio/.rvm/gems/ruby-2.1.2/bundler/gems/devise_token_auth-47e8848cf124/app/controllers/devise_token_auth/confirmations_controller.rb:22:in `show'```

@benbencj
Copy link

benbencj commented Oct 2, 2015

having the same issue

@lexton
Copy link

lexton commented Nov 13, 2015

I had generated the devise views myself. Inside the confirmation link I added the redirect_url as a param.

app/views/devise/mailer/confirmation_email.erb
Manual Fix:

    <p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token, redirect_url: root_url) %></p>

This meant that the render didn't collapse when trying to get the redirect_url.

Automatic fix:
rails generate devise_token_auth:install_views

You will get the correct views.

<%= link_to 'Confirm my account', confirmation_url(@resource, {confirmation_token: @token, config: message['client-config'].to_s, redirect_url: message['redirect-url']}).html_safe %>

@zachfeldman
Copy link
Contributor

Seems to be a solution here/no activity. Closing for now.

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

4 participants