facebook single sign on+5

This is a cleaned up version of #803.