Split the authorization into a separate method

This allows it to be used programmatically for embedding into themes/etc more
easily.