Let me just expand what people written in the comments.
Given a fibration $F \to E \to B$ of pointed spaces and $X$ be a space with a map
$f: X \to E$. Then, the space of lifts $f' : X \to F$ is equivalent to the space of null-homotopies of the composition $X \to E \to B$.

Choosing
$F = BSpin_n$, $E = BSO_n$, $B = K(\mathbb{Z}/2,2)$
we see that the space of lifts of a map
$f : X \to BSO_n$ to $BSpin_n$ is precisely the space of null-homotopies of
the map $w_2(f) : X \to K(\mathbb{Z}/2,2)$.
If this space is not empty, then the map $w_2(f)$ is null homotopic, and so we can choose a given null-homotopy $H$. Then, $H$ can be used to identify the space of null-homotopies with the space of null-homotopies of the constant map, which is $Hom(X,\Omega(K(\mathbb{Z}/2,2))) \cong Hom(X,K(\mathbb{Z}/2,1))$.
Algebraically, this correspond to choosing a given $\alpha \in C^1(X,\mathbb{Z}/2)$ such that $d\alpha = w_2(f)$. Then, every other such $\alpha'$ gives a 1-cocycle $\alpha - \alpha' \in Z^1(X,\mathbb{Z}/2)$.

Anyway, without choosing the homotopy $H$, we just have an action of
the "group" ($\mathbb{E}_1$-space) $Hom(X,\Omega K(\mathbb{Z}/2,1))$ on the
space of null-homotopies of $f$, and this action is a torsor in the sense that
the action map
$$Hom(X,\Omega K(\mathbb{Z}/2,2)) \times NH(f) \to NH(f) \times NH(f)$$,
$(T,H) \mapsto (T \square H,T)$
is a homotopy equivalence, where here $NH(f)$ stands for the space of null-homotopies of $f$.

In particular, for every choice of point $H \in NH(f)$ we get a homotopy equivalence as stated above.

Now all the results about cohomology are obtained by taking $\pi_0$ from the topological fact above.

witnessto w_2 vanishing. There can be lots of lifts. $\endgroup$ – Dylan Wilson Apr 1 '18 at 14:17