# Principal and Vector bundles over stacks

I am reading some papers concerning the moduli stack of vector bundles and there is some notion that I don't understand. Let us consider $$\text{Vect}_{n}$$ the stack of vector bundles with isomorphisms over the category of $$k$$-schemes, being $$k$$ an algebraically closed field of characteristic $$0$$. Given another stack $$\mathcal{X}$$ over $$\text{Sch}_{k}$$, some authors considered a vector bundle over $$\mathcal{X}$$. My question is, what is a vector bundle of rank $$n$$ over $$\mathcal{X}$$? A priori I thought that maybe a vector bundle over $$\mathcal{X}$$ is just a morphism of stacks $$\mathcal{X}\rightarrow\text{Vect}_{n}$$, but after this first impression, people start to work with a $$\textit{vector bundle}$$ $$E\rightarrow \mathcal{X}$$ as in the usual case of $$k$$-schemes. They even consider the pullback of a vector bundle on $$\mathcal{X}$$ by a morphism of stacks $$\mathcal{Y}\rightarrow\mathcal{X}$$. Could you help me to grasp this notion or at least give me some references?

Let $$\mathcal{S}$$ be a stack(differentiable, algebraic, topological,..etc). Let $$\bar{\mathcal{M}}$$ denote the canonical stack associated to a space $$M$$. Then there is a canonical equivalence of categories between $$\mathcal{S}(M)$$ and $$\rm{Mor}_{stacks}(\bar{\mathcal{M}},\mathcal{S})$$ where the later denote the category of morphism of stacks.
Now, consider the stack $$\rm{Vect}_{n}$$ over algebraic spaces. Now applying the above Yoneda lemma of stacks we get an equivalence of categories between $$\rm{Vect}_{n}(M)$$ and $$\rm{Mor}_{stacks}(\bar{\mathcal{M}},\rm{Vect}_{n})$$.
I think you are asking whether we can extend this result for any general stack $$\mathcal{X}$$ or not. (i.e not necessarily stacks of the form $$\bar{\mathcal{M}}$$).