Aims. We present the time-resolved optical emission of gamma-ray bursts GRB 060904B and GRB 070420 during their prompt and early afterglow phases.
Methods. We used time resolved photometry from optical data taken by the TAROT telescope and time resolved spectroscopy at high energies from the Swift spacecraft instrument.
Results. The optical emissions of both GRBs are found to increase from the end of the prompt phase, passing to a maximum of brightness at t(peak) = 9.2 min and 3.3 min for GRB 060904B and GRB 070420 respectively and then decrease. GRB 060904B presents a large optical plateau and a very large X-ray flare. We argue that the very large X-flare occurring near tpeak is produced by an extended internal engine activity and is only a coincidence with the optical emission. GRB 070420 observations would support this idea because there was no X-flare during the optical peak. The nature of the optical plateau of GRB 060904B is less clear and might be related to the late energy injection.