The inclusive J/ψ elliptic (v2) and triangular (v3) flow coefficients measured at forward rapidity (2.5 < y < 4) and the v2 measured at midrapidity (|y| < 0.9) in Pb-Pb collisions at $$ \sqrt{s_{\mathrm{NN}}} $$
s
NN
= 5.02 TeV using the ALICE detector at the LHC are reported. The entire Pb-Pb data sample collected during Run 2 is employed, amounting to an integrated luminosity of 750 μb−1 at forward rapidity and 93 μb−1 at midrapidity. The results are obtained using the scalar product method and are reported as a function of transverse momentum pT and collision centrality. At midrapidity, the J/ψ v2 is in agreement with the forward rapidity measurement. The centrality averaged results indicate a positive J/ψ v3 with a significance of more than 5σ at forward rapidity in the pT range 2 < pT< 5 GeV/c. The forward rapidity v2, v3, and v3/v2 results at low and intermediate pT (pT ≲ 8 GeV/c) exhibit a mass hierarchy when compared to pions and D mesons, while converging into a species-independent curve at higher pT. At low and intermediate pT, the results could be interpreted in terms of a later thermalization of charm quarks compared to light quarks, while at high pT, path-length dependent effects seem to dominate. The J/ψ v2 measurements are further compared to a microscopic transport model calculation. Using a simplified extension of the quark scaling approach involving both light and charm quark flow components, it is shown that the D-meson vn measurements can be described based on those for charged pions and J/ψ flow.