I have noticed some fact about cohomologie : when i have some kind of strucutre in a topos (for example the $G$-object for $G$ a group object in the topos) and a particular object $X$ model of this strucutre such that the sheaf of automorphism of $X$ is a sheaf of commutative group, Then there is (at least on a lot of examples) a bijection between isomorphism class of model of this structure which are locally isomorphic to $X$ and $H^1(T,G)$.
Examples I have in mind are the representation of dimension 1 of a group $G$ over a field $k$ which correspond in one hand to one dimensional $k$-vector space in the topos of $G$-set and on the other hand to the cohomology group $H^1(G-set,k^*) $. Or the principal bundle over a topological space $X$ which corresponds to some $H^1(X,G)$ too.
Is there a "general explication" to those facts ? I mean by that a result valid on an arbitrary topos who gave a bijection between a $H^1(T,G)$ and isomorphism class of objects internally isomorph.
And Is there "higher dimensional" generalization ? ( I am working on an example which seem to involve a 2-category of object inside a topos $T$ and where "equivalence class" of objects "localy equivalent" seem to be classified by some $H^2$ group in a way that i don't understand yet... )
Thank you !