Recently I read in Milne's book "etale cohomology" that the set $H^1(X,\mu_n)$ ($X$ a scheme, $n$ a nature number, the cohomology is flat cohomology) can be described as the set of pairs $(L,\phi)$, where $L$ is a line bundle on $X$, $\phi$ is a trivialization $O_X\to L^{\otimes n}$.

Given such a pair $(L,\phi)$ one can easily construct a torsor (as was explained in Milne's book page 125): Zariski locally (say Spec$(A)=U\subseteq X$) one gets a trivialization $\psi: O_U\to L$, using this one gets a global section $e\in \Gamma(U,L)$, so $e^{\otimes n}$ is a base of $L^{\otimes n}$. Using the trivialization $\phi: O_U\to L^{\otimes n}$, one gets an element $a\in$$A$ such that $e^{\otimes n}=a\phi(1)$. Then one gets a $\mu_n$ torsor Spec$A[T]/(T^n-a)$, we can patch all these torsors which are constructed Zariski locally together to get a $\mu_n$-torsor on $X$.

How about the converse, i.e given a $\mu_n$-torsor $\pi: P\to X$ how can we get such a pair?

I figured that since $P\times_X P\cong P\times_X\mu_n=$Spec($O_P[T]/(T^n-1)$), one gets a $n$-th roots of unity $a\in \Gamma(P\times_X P,O_{P\times_X P})$ by taking the image of $T$. Thus $a$ defines an automorphism of $O_{P\times_X P}$. If this automorphism satisfies cocycle condition $$p_{12}^*(a)p_{23}^*(a)=p_{13}^*(a)\in \Gamma(P\times_XP\times_XP,O_{P\times_XP\times_XP})$$ then one can get a line bundle on $X$ using fpqc descent. I think it is true that $a$ satisfies cocycle condition, but I have difficulty in verifying this, can anyone help me out? Thanks.