added changes to support OAuth