Refined authorize feature to capture invalid token error