wesleylima / django-rest-framework-firebase

Use Firebase to authenticate requests to your Django Rest Framework project
32 stars 14 forks source link

Anonymous Auth scope of this package? #10

Closed ghost closed 4 years ago

ghost commented 5 years ago

Hello,

first of all - thanks for your package, it made integration with Firebase Auth quite easy for me. :)

I have a question regarding the anonymous auth functionality of Firebase and using it with this package. Currently this seems to be not supported by this package.

I looked at the source code and saw this check in the BaseFirebaseAuthentication class: if 'email_verified' not in payload or ('email_verified' in payload and not payload['email_verified']):

As users with anonymous auth don't have any e-mail address, this check will always raise AuthenticationFailed exception.

I was wondering whether this part should be refactored into its own authentication class, called FirebaseAuthWithValidEmail or something like that.

I imagine the following scenarios which are currently not possible:

In the documentation I saw that one can use multiple authentication classes. So by refactoring this part mentioned above into its own class and extending the BaseFirebaseAuthentication for every usecase (like anonymous auth), we could create different authentication classes.

I'm no expert in DRF, that's why I'm not sure whether my proposal makes any sense. If you think it makes sense, I would try to work on that.

wesleylima commented 4 years ago

I believe this was address by PR #11 Shout out to @mands Please re-open the issue if you need this to be more robust.