Capture OAuth token request error edge cases

Fix #983