Consolidate common auth code.

Details

Description

Auth handling is not consistent between gadget rendering and social data access. Some of this is intentional (outbound auth for rendering and inbound OAuth support for social api), but most of it is not.