Robert King


50 Experience
0 Lessons Completed
0 Questions Solved


I am trying to use ng-token-auth (Angular 1) on a separate frontend to allow passwords to be reset and account e-mail addresses to be confirmed on a Ruby on Rails 5.0 backend.

Whenever I request a password reset I get the following kind of link back:

http://localhost:8080/?client_id=<client_id>&config=default&expiry=<expiry_stamp>reset_password=true&token=<token>&uid=<email address>#/reset-password

Instead of getting the #/reset-password before the query string like below, it keeps getting added onto the end and messing up when it does the redirect. When it lands on the reset-password ui state, the controller for that state cant operate correctly.

In app/views/devise/mailer/reset_password_instructions.html.erb I have the following template code:

    <p><%= t(:hello).capitalize %> <%= %>!</p>

    <p><%= t '.request_reset_link_msg' %></p>

    <p><%= link_to t('.password_change_link'), edit_password_url(@resource, reset_password_token: @token, config: message['client-config'].to_s, redirect_url: message['redirect-url'].to_s).html_safe %></p>

    <p><%= t '.ignore_mail_msg' %></p>
    <p><%= t '.no_changes_msg' %></p>

Inside of my app.js on the frontend, I am configuring $authProvider with the following:

   function AuthSetup($authProvider) {
      apiUrl: 'http://localhost:3000',
      passwordResetSuccessUrl: 'http://localhost:8080/#/reset-password'

I would greatly appreciate any help or guidance anyone could offer. Thanks.

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.