add oauth support

This code adds basic OAuth support