Several OAuth bug fixes and improved logging

Change-Id: Ic6793f207c58a60d493e21633e4e23ca48029ed4