'Error using devise_token_auth gem Rails 7

So I'm trying to generate a token for my Rails 7 app with devise_token_auth and I found this gem but I get this error and I understand that the gem is no longer updated:

Fetchings gem metadata from https://rubygems.org/...........
Resolving dependencies....
Bundler could not finde compatible versions from gem "rails":
    In Gemfile:
        rails (~> 7.0.1)

    devise_token_auth was resolved to 0.1.21.alpha2, which depends on
        rails (~> 4.1.4)

So what can I do about it? Are there more gems like devise_token_auth? I can fix it without chainging my Rails version?

Thanks!



Solution 1:[1]

The latest version of devise_token_auth on rubygems (1.2.0) doesn't support rails 7, but the latest code on GitHub does support rails 7.

Try adding the gem like this

gem 'devise_token_auth', '>= 1.2.0', git: "https://github.com/lynndylanhurley/devise_token_auth"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Cameron