For a Lie group, its delooping is a smooth groupoid, which we may think of as a groupoid internal to smooth spaces.
According to the theory of models for ∞-stack (∞,1)-toposes this is to be thought of as modeling the corresponding smooth ∞-stack of smooth -principal bundles obtained after ∞-stackification.
The cohomology with coefficients in is degree 1 smooth nonabelian cohomology.
Let be the Lie algebra of .
The groupoid of -valued differential forms , denoted here , is the refinement of in differential nonabelian cohomology.
For a Lie group the groupoid of -valued differential forms is as a groupoid internal to smooth spaces, the sheaf of groupoids
that to a smooth test space assigns the functor category of smooth functors (functors internal to smooth spaces) from the path groupoid of to the one-object delooping groupoid .
The groupoid is canonically equivalent to the smooth groupoid where
objects are smooth -valued 1-forms ;
morphisms are given by smooth -valued functions such that
Here is the right invariant canonical -valued 1-form on . A more sloppy but common way to write this is .
The cohomology with coefficients in classifies -principal bundles connection on a bundle with connection.
More is true: there is a natural canonical equivalence of groupoids
There is the obvious projection
Lifting a -cocycle through this projection to a differential -cocycle means equipping it with a connection.
For these differential cocycles model the Yang-Mills field in physics.
For the sheaf coincides with the the Deligne complex in degree 2, , as described there.
The idea goes back to John Baez. For a detailed history see the discussion at Differential Nonabelian Cohomology.
The details are in
The definition in terms of differential forms is def 4.6 there. The equivalence to is proposition 4.7.