The WZW model on the sphere $S^2$ with group $G$ and level $k$ is described by the action for a $G$-valued field $g : S^2\to G$ (see these notes by Lorenz Eberhardt):
$$S[g]=\dfrac{1}{4\lambda^2}\int_{S^2}d^2z\ \operatorname{tr}(g^{-1}\partial_\mu g \ g^{-1}\partial^\mu g)-\dfrac{ik}{12\pi}\int_Bd^3y\ \epsilon_{\alpha\beta\gamma}\operatorname{tr}(g^{-1}\partial^\alpha g\ g^{-1}\partial^\beta g\ g^{-1}\partial^\gamma g).\tag{1}$$
On the other hand, the Polyakov action for the bosonic string in a background spacetime $(M,g)$$(M,G)$ is $$S_P=\dfrac{T}{2}\int d^2\sigma\sqrt{h}\ h^{ab}g_{\mu\nu}\partial_a X^\mu \partial_b X^\nu\tag{2}.$$$$S_P=\dfrac{T}{2}\int d^2\sigma\sqrt{h}\ h^{ab}G_{\mu\nu}\partial_a X^\mu \partial_b X^\nu\tag{2}.$$
Now, I've heard that string theory on ${\rm AdS}_3$ is somehow equivalent to a WZW model with group ${\rm SL}(2,\mathbb{R})$. In particular this is briefly mentioned in the notes I have linked and is discussed by Maldacena and Ooguri in arXiv:0001053. The thing is that I can't see how is the string theory in ${\rm AdS}_3$ a WZW model.
The authors seem to argue that as a manifold ${\rm SL}(2,\mathbb{R})\simeq {\rm AdS}_3$. In that case I do understand that if we consider string theory in ${\rm AdS}_3$ we would have fields in a two-dimensional surface (the worldsheet), taking values in ${\rm AdS}_3$ (the target space), which turns out to be as a manifold the same as the group under consideration.
But at the level of the actions it seems things are quite different. I see no way in which (1) and (2) end up describing the same theory in the worldsheet. And perhaps this is not even the point for this equivalence.
So what is behind this equivalence between string theory in ${\rm AdS}_3$ and the ${\rm SL}(2,\mathbb{R})$ WZW model on the worldsheet?