gsocneurostarsbiostarorcidoauthdjango-allauth

Adding ORCID Provider to django-allauth

In a previous post I have been talking about the integration of ORCID in NeuroStars during GSoC2014. In particular we would like to provide two new features:

  • Signup/login using a ORCID account (via OAuth);
  • Import data from a ORCID profile to a NeuroStars profile.

django-allauth is a Django library, built on top of requests-oauthlib, which provides Django projects with similar features and works with many providers like Amazon, Facebook, GitHub, Twitter, Google, LinkedIn, etc.

We decided to contribute to the django-allauth project and add support for the ORCID provider.

The OAuth flow implemented by ORCID is standard and the architecture of code in django-allauth is quite easy to understand, even though not documented: so I just had to write a few lines of code to extend some base classes and the result was just great. My contribution was merged into the master branch quite quickly.

We have then used the updated django-allauth library to integrate ORCID as social login provider in NeuroStars with the following scenario:

  • a user wants to signup in NeuroStars using her ORCID account; she clicks on a “Signup with ORCID” link;
  • the OAuth flow begins and the user is redirected to Orcid.org to a page where she is asked to authorize NeuroStars to access her ORCID profile info;
  • the user confirms and she is redirected back to NeuroStars to a page which asks if she wants to use her ORCID bio as her NeuroStars profile info;
  • the user might choose to ignore the question or confirm; if she confirms she is redirected to her profile page.

Some screenshots:

Adding the ORCID social login provider.
Authorizing Biostars (or NeuroStars) to access the ORCID profile info.
Asking to import ORCID profile info to NeuroStars.
The user profile after having imported the profile info.