bennylope / django-organizations

:couple: Multi-user accounts for Django projects
http://django-organizations.readthedocs.org/
BSD 2-Clause "Simplified" License
1.29k stars 212 forks source link

Integration with django-allauth (social auth) #140

Open bittner opened 6 years ago

bittner commented 6 years ago

(I'm sorry to be so blunt and ask this before trying it out myself. Forgive!)

The README says:

  • Invitation and registration functionality works out of the box for many situations and can be extended as need to fit specific requirements.

... yet it doesn't mention social authentication, such as django-allauth, explicitly.

How easy is it to integrate social authentication? Would django-allauth work (almost) out of the box?

bennylope commented 6 years ago

django-organizations doesn't "care" about the authorization system, so it works nicely side by side with social authentication.

The invitation component specifically is where you might need to extend this if, say, you wanted to send invitations over that social media channel rather than via email.

Where you might need to make other changes is allowing someone to register or respond to an invitation to an organization and create their user account - this is where you'll want to extend the backend https://github.com/bennylope/django-organizations/blob/dev/organizations/backends/defaults.py#L108

Provided you want to use social authentication directly in the registration and invitation process it's not quite out of the box but it should be reasonably straightforward to support.

If you have an updated backend for this a PR would be welcome to add for other people looking to integrate this themselves!

loxllxol commented 6 years ago

I'm using all-auth for email login/registration (more specifically django-rest-auth, which requires all-auth). I'm not using social logins. Currently, the invitations and registration is handled by django-rest-auth. Do I have to override the INVITATION_BACKEND and REGISTRATION_BACKEND settings and call it a day?

Anything else I'd need to do?

nemesifier commented 6 years ago

@bittner @loxllxol you can take a look at this open source module which implements both django-organizations and django-allauth for OpenWISP 2 (a recently released open source wifi controller built with python & django).

It's really just a matter of correct setup and integration.