Email Validation with Django and python-social-auth

So you’re asking yourself – robot or real person?

When it comes to user accounts, the standard litmus test is email validation. Besides the immediate benefits – of offering us a straightforward unique identifier for users, and making it more difficult to automate creating a mass of accounts on our service – by requiring that each account have an email address and interact therewith to confirm the addresses validity, it also offers us the chance to associate a known-working email account with a user account. This is important for transactional emails such as password resets or for potential two-factor authentication use… and if you’re a little less ethical, for sending marketing desirable and informative emails about interesting products and services.

"But," you whine piteously, "the whole reason I integrated python-social-auth into my project was to let the OAuth providers look after this sort of thing for me!"

Tough rocks. Twitter ain’t gonna give you their users’ email addresses. Just look at all those angry comments. If their whining didn’t get through to Twitter, yours isn’t going to do the trick either. Besides, eventually you’ll probably want to allow the user to login the good old-fashioned way, with a username (which may or may not be their email address) and a password – in which case, you’ll want to handle validating their email address yourself anyways.

So, given that we’ve already integrated python-social-auth into our Django project (some of the same principles will apply to other frameworks, but many of the details presented herein are specified to Django) – let’s get email validation working as part of our user creation/authentication pipeline.

(more…)

2014 Review: Day 4

As 2014 winds down, we’re taking an opportunity to look back at some of our most-read posts from this year, in case you missed them the first time. 

django-logo-negative

Vlad Orlenko wrote a couple of great posts on integrating social logins and posting with web apps written using the Django web app framework:

(more…)

Tutorial: Posting to Facebook from a Django App

This tutorial is the first part of a series of tutorials that build a complete Django application, codenamed “procrastination automation”. The tutorial on Python Social Authentication can be considered a preface to this series – if you would like an introduction into using social authentication with Python or Django, check it out.

django-logo-negative

Some time ago, I saw a diagram that showed how content originates from 4chan (or was it 9gag?), then gets reused by Reddit, then gets reposted on Digg, and ends up on Facebook. Don’t google it, it is using a very ugly image for the metaphor. But the idea is that thousands of people are viewing things on one subset of social resources and reposting on another subset, where this content becomes the source of entertainment and news for more viewers.

Literally millions of man-hours are spent daily to transfer images of cat-based memes from Reddit to Facebook. This is a perfect opportunity for automation.

Let’s build an app that will allow a person who would ordinarily browse Reddit a few hours a day and repost pretty much every link from a favourite subreddit to Facebook, set a personal re-poster that will automatically forward those updates from Reddit to his Facebook wall for him, impressing his friends with his immense social presence, and saving his precious time. (more…)