Flat principal bundles over a simply connected manifold are trivial I am looking for a proof of the following result.

Let $p:P\to M$ be a $G$-principal bundle over a connected and simply connected manifold.
  Suppose there is a flat connection $A\in\Omega^1(P,\mathfrak{g})$, that is $F^A\equiv 0$.
  Then $P$ is trivial and there exists a global section $s:M\to P$ such that $s^*A \equiv 0$.

That a global section on $P$ implies that it is trivial is well known, so the first task is showing that $P$ is trivial.
It seems that this is a "well known fact", but I could find no concise proofs.
Wikipedia suggests that this is closely related to the holonomy of $A$.
Even then, I don't know how do we hit the $s^*A$ condition.
 A: A connection in a principal $G$-bundle $P$ is said to be flat at $u\in P$ if there is a local trivialization of the bundle in a neighborhood of u, $(U_{\alpha},\psi_{\alpha})$,  under which the given horizontal subspaces map to the horizontal subspaces of the trivial connection on the corresponding trivial bundle.
Consider the local section $s(m)=\psi_{\alpha}(m,e)$, being $e$ the identity element in $G$. Since the horizontal space at $s(m)$ consists of those $V\in T_{s(m)}P$ such that $A_{s(m)}(V)=0$  it is clear that
$$
s^*(A)_{m}(X)=A_{s(m)}(ds_m(X))=0
$$
and so $s^*(A)=0$.
On the other hand, I don't know how to solve the part that $P$ being trivial, that is, that $s$ is global. Sorry.
A: I found the result you want to prove as exercise 5.15.4 in Mathematical Gauge Theory of Mark J.D. Hamilton.
I will use the same notations that the ones in the book: $(P, M, G, \pi)$ is the $G$-principal bundle, with connection $A\in\Omega^1(P, \mathfrak{g})$ and curvature $F$, Ehresmann connection $H$ (horizontal sub-bundle of $TP$ defined by $A$), and base manifold $M$. Here $M$ is supposed to be connected and simply-connected.
The way I solve it use two results: Frobenius theorem, and the homotopy lifting property.
The exercise guides you to show that the curvature vanishes if and only if the horizontal bundle is involutive, i.e. a foliation by using Frobenius theorem. So around each point $p\in P$ there is an open neighborhood $V$ and a system of local coordinates $(x^1, \dots, x^m): V\to \mathbb{R}$ such that the components of the foliation in $V$ are described by the equations $x^{n+1}=c_{n+1}, \dots, x^m=c_m$ where the $(c_i)$ are constant.
This allows you define a local section $s: U=\pi(V)\to P_{U}=\pi^{-1}(U)$ such that if $(x^1,\dots, x^n)$ are the local coordinates in $U$ around $x=\pi(p)$, we have $s(x^1,\dots, x^n)=(x^1,\dots, x^n, 0\dots, 0)$. The image of $s$ is thus the component of the foliation that goes through $p$ in $P_U$, and a local sub-manifold of $P$ whose tangent space at each point is exactly the horizontal space at this point.
Let $H_p$ denotes the component of the foliation that goes through $p$.
Because of the local property of the foliation, we see that the intersection of $H_p$ with the fiber $\pi^{-1}(x)$ contains $p$ and is disconnected. Let $\pi_H$ be $\pi_{\mid H_p}$. We see also that $\pi_H$ is a local diffeomorphism at each point of $H_p$ from an open in $H_p$ onto its image by $\pi$ in $M$, with local inverse a local section looking like the $s$ just described.
From $x=\pi(p)$ each point $y$ of $M$ connected can be reached by a smooth path $\gamma_y: [0, 1]\to M$ with $\gamma_y(0)=x$ and $\gamma_y(1)=y$. There is a unique horizontal lift of $\gamma_y$ which we denote $\gamma^*: I\to P$ such that $\gamma^*(0)=p$, and $\gamma^*(I)\subset H_p$, by definition of the component of the horizontal foliation going through $p$. The existence and unicity of such a lift is given in the book by theorem 5.8.2 about Parallel Transport (the proof given of this theorem is quite incomplete, dealing only with local existence. But it is well known that it is valid globally on $M$). From $\pi_H(\gamma^*(1))=y$ we get that $\pi_H$ is surjective.
To get that it is injective, we suppose that there is $q\neq p$ in $H_p\cap\pi^{-1}(x)$. As a connected sub-manifold of $P$, there exist path $\gamma$ in $H_p$ connecting $p$ to $q$. Then the loop $\pi_H(\gamma)$ is homotopic to the point $x$ because $M$ is simply connected. Using the homotopy path lifting property, and the fact that the intersection of the fiber in $P$ above $x$ with $H_p$ is completely disconnected, we see that $q\neq p$ is not possible.
Since $\pi_P$ is injective, surjective and a local diffeomorphism, it is a global diffeomorphism from $H_p$ to $M$. We therefore have a global section $s=\pi_H^{-1}: M\to H_p\subset P$, which shows that $P$ is a trivial bundle. We also get for free immediately that $s^*A=0$.
A: A connection on a principal bundle is defined by a distribution ${\cal H}$ transverse to the fibers. Saying that the connection is flat is equivalent to saying that ${\cal H}$ is integrable and define a foliation transverse to the fibres this is equivalent to saying that $P$ is a suspension bundle, that is a quotient  $(x,y)\rightarrow (\gamma(x),h(\gamma)(y))$ where $h:\pi_1(M)\rightarrow Diff(G)$ is a representation of $\pi_1(M)$ and $\hat M$ the universal cover of $M$, if $\pi_1(M)=1$, then $P$ is isomorphic to $M\times G$.
