[SOLVED] Implement Devise token auth in existing rails app


This Content is from Stack Overflow. Question asked by Muhammad Ans

I am working on a rails 7 app which has devise authentication running properly. I want to implement devise token auth in it. I have set up all the thing but devise token auth produces a migration file and creates users table. Exactly here i am getting the error that users already exist. What should I do.


I haven’t tried, but I think what you could do is, check the generated migrations, and copy all extra fields that doesn’t exist in User model, then delete that migration (you could also rename it) and then generate new migration just to add new fields to User Model. It should work fine.

Here, I found similar post, https://whatraghulearned.wordpress.com/2019/07/15/add-devise_token_auth-to-an-existing-rails-app/
It also suggests to add extra fields. You can follow this article too

This Question was asked in StackOverflow by Muhammad Ans and Answered by Biki Maharjan It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?