Let me work in any category $\mathcal{C}$ with fiber products. Let $A,B\in \operatorname{Obj}(\mathcal{C})$ be any objects. I want to show that $$A\times_A B=B$$
I know the following universal property of the fiber product:
Given elements $X,Y,S\in \operatorname{Obj}(\mathcal{C})$ with morphisms $X\rightarrow S$ and $Y\rightarrow S$ then the fiber product $X\times_S Y$ sits in the following diagram with projection maps $X\times_S Y\rightarrow Y$ and $X\times_S Y\rightarrow X$ and for every other object $Z$ with maps $Z\rightarrow X$ and $Z\rightarrow Y$ s.t. $Z\rightarrow X\rightarrow S=Z\rightarrow Y\rightarrow S$ there exists a unique map $Z\rightarrow X\times_S Y$
Now I thought to show that $A\times_A B=B$ I need to show that $B$ satisfies this universal property. Therefore I wanted to take such a $Z$ with maps $Z\rightarrow A$ and $Z\rightarrow B$, but I don't see how to conclude that there is a unique map $Z\rightarrow B$?
Can maybe someone help me?

The pullback of a morphism along an identity is the same morphism.
Take a morphism $f\colon B\rightarrow A$ and consider the diagram $A\xrightarrow{\operatorname{id}_A}A\xleftarrow{f}B$, then the pullback is $A\times_AB\cong B$ with $f$ and $\operatorname{id}_B$ being the morphisms into $A$ and $B$ respectivly.
Consider a morphism $g\colon Z\rightarrow B$. To get a commutative outer diagram, we need a suitable morphism $\phi\colon Z\rightarrow A$ fulfilling $\operatorname{id}_A\circ\phi=f\circ g$, so we have $\phi=f\circ g$.
For the universal property, we need to show the existence and uniqueness of a morphism $\psi\colon Z\rightarrow A\times_AB\cong B$ with $g=\operatorname{id}_B\circ\psi$ and $fg=f\circ\psi$. $\psi=g$ fulfills this condition (existence) and because of the left equation is the only morphism to do so (uniqueness).