devise_token_auth icon indicating copy to clipboard operation
devise_token_auth copied to clipboard

Not compatible with Rails 6? "File unchanged! The supplied flag value not found!"

Open lucasrogeriomasotti opened this issue 4 years ago • 4 comments

Versions:

  • devise_token_auth (~> 1.1.4)
  • rails (~> 6.0.3)
  • ruby 2.7.1p83

When running the install:

rails g devise_token_auth:install
      create  config/initializers/devise_token_auth.rb
      insert  app/controllers/application_controller.rb
        gsub  config/routes.rb
      create  db/migrate/20200806121308_devise_token_auth_create_users.rb
File unchanged! The supplied flag value not found!  app/models/user.rb

I think it's related to https://github.com/lynndylanhurley/devise_token_auth/issues/1400 and https://github.com/lynndylanhurley/devise_token_auth/pull/1414 is supposed to fix it, but I think the current version (1.1.4) does not include the fix yet.

When will we have a new version of the gem?

lucasrogeriomasotti avatar Aug 06 '20 12:08 lucasrogeriomasotti

Same error here, i was reading something about downgrading the gem but it didn't work for me.

hvilloria avatar Aug 10 '20 23:08 hvilloria

You can fix it by using: gem 'devise_token_auth', github: 'lynndylanhurley/devise_token_auth'

At the top of my gemfile I have:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

lucasrogeriomasotti avatar Aug 11 '20 03:08 lucasrogeriomasotti

Pulling the gem from github didn't solve this for me.

Gemfile.lock says I got revision: 2a83ef96b2e5aaeb6b21055127880f85752bd219 which I can see includes #1414. So is there a reason why I still get this error?

I already have a User model, so according to the docs:

If the model already exists, a concern (and fields for Mongoid) will be included at the file

This did not happen automatically, what's more is I had to also dig through issues to figure out why numerous other problems popped up after adding it, finally ending up with this:

class User < ApplicationRecord
  devise :database_authenticatable, :recoverable, :rememberable, :validatable, :timeoutable
  include DeviseTokenAuth::Concerns::ActiveRecordSupport
  include DeviseTokenAuth::Concerns::User

That's not the end of the story, but it's the end of how it relates to this issue. I'm using regular Devise auth alongside token auth with Rails 6, so it's not API-only & perhaps more complicated of a use case than intended. There are several bugs related to this usage and the documentation is ~50% incomplete. Hacking through workarounds dug up in several issues is necessary, starting from the first installation step gem 'devise_token_auth'. Definitely unexpected!

AFlowOfCode avatar Nov 23 '20 23:11 AFlowOfCode

Heres my findings:

  • Attempting to run the install on a Rails API application threw the error File unchanged! The supplied flag value not found! app/models/user.rb
  • Attempting to run the install on a Rails Application gave me no issues

My config for the rails application:

  • ruby 2.7.1
  • rails 6.0.3.4
  • used gem 'devise_token_auth', github: 'lynndylanhurley/devise_token_auth'

TediPapajorgji avatar Nov 27 '20 05:11 TediPapajorgji