Let me begin with some motivation. In calculating the Chern-Simons invariant of a $U(1)$ connection $A$ on a 3-manifold $M$, we can proceed by picking a bounding 4-manifold $X$ with $\partial X = M$ and an extension of $A$ to $X$ and write $$ CS(A)=\frac{k}{4 \pi^2}\int_X dA \wedge dA, $$ where the level $k$ must be an integer for this expression to be well-defined up to $2 \pi i$ when we choose a different bounding 4-manifold. However, if we have a spin structure everywhere, then on a closed 4-manifold, this expression is always an even multiple of $2\pi i$ since the intersection form is even. Thus, we can let $k$ be a half-integer and still get a well-defined invariant one we exponentiate.
I'm interested in understanding what's going on here on a more general level. It seems that often when we have a spin structure (or some other geometric structure) characteristic classes of bundles other than the tangent bundle turn out to have some divisibility property.
My question is: on a principal bundle, where does one see what the spin structure gives you?
In particular, if we have a principal bundle for say a finite group $G$, then this is classified by a map $$ f:X\to BG. $$ A cohomology class $\omega \in H^k(BG, \mathbb{Z})$ gives a class $f^*\omega \in H^k(X,\mathbb{Z})$. I want to know how the vanishing of certain characteristic classes of the tangent bundle, eg. $w_2$, imply the vanishing of $f^*\omega$ in some reduction $H^k(X,\mathbb{Z}/n\mathbb{Z})$, eg. $n=2$.