core: save session if code is not provided but required