check for null redirectUri to prevent NullReferenceException and throw a better error