better newAuthorization handling in js