lynndylanhurley / lynndylanhurley/devise_token_auth

How to implement username as provider?

Open
#1,066 2 comments 0 reactions 1 assignee Claimed by @MaicolBen View on GitHub
Dominant language
Ruby
Stars
3.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

I would like to implement a custom devise strategy where my User's `provider` is `'username'`, with a custom `username` field and `recovery_email` field along with it, validated in my User model, to ensure I can still log in for this user.

I had an implementation with this behaviour and validations all setup in my User model, however, in multiple places `devise_token_auth` overrides my User model to force a `provider = 'email'` even when I explicitly do not want it to.

I've seen other issues [describing this matter](https://github.com/lynndylanhurley/devise_token_auth/pull/998), but nothing concrete about[ how to go about doing it](https://github.com/lynndylanhurley/devise_token_auth/pull/964/).

Most ideal would be for the solution for username/email logins to echo closely with what's recommended in the devise guide [*How to: Allow users to sign in using their username or email address*](https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign-in-using-their-username-or-email-address).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.