For a nonunital ring $R$ (or "rng") one has to be a little bit careful when considering the category of (left or right) $R$-module and, furthermore, the standard equivalent definitions of projective modules are in general not equivalent anymore (see e.g.<https://math.stackexchange.com/questions/120458/projective-modules-over-rings-without-unit>). To fix terminology: by projective module we mean the standard categorical definition <https://en.wikipedia.org/wiki/Projective_module>.


Let $M\_n(R)$ denote the set of $(n\times n)$-matrices with entries from $R$ and let $e\in M\_n(R)$ and $f\in M\_m(R)$ be idempotents. It is easy to show that $M=eR^n$ and $N=fR^m$ are projective modules. For a *unital* ring, the statement that $M$ is isomorphic to $N$ is equivalent to saying that there exists $u\in GL\_k(R)$ such that $e=ufu^{-1}$ (tacitly assuming an appropriate $k$ and an embedding for $e$ and $f$ into $M\_k(R)$). Now, what is the corresponding statement for nonunital rings?


The usual algebraic definition of equivalence of idempotents state that $e\sim f$ if there exists $x,y$ such that $e=xy$ and $f=yx$. It is easy to see that this implies that $M\simeq N$ (multiplication by $y$ gives the isomorphism $M\to N$). Now, is the converse true? That is, if $M\simeq N$ then there exists $x,y$ such that $e=xy$ and $f=yx$?


The standard proof for unital rings uses the fact that a projective module is a direct summand of a free module, which may no longer be true for nonunital rings.



Equivalence of idempotents and projective modules over nonunital rings
If $R$ is a ring (not necessarily unital) and $e\in R$ is an idempotent, then it is still the case that $Hom\_R(eR,M)\cong Me$ for any right $R$-module $M$ via $\phi\mapsto \phi(e)$. It immediately follows that, if $e,f\in R$ are two idempotents, then $eR\cong fR$ if and only if there exists $a\in eRf$ and $b\in fRe$ with $ab=e$ and $ba=f$. This is equivalent to your condition once you notice that if $e=xy$ and $f=yx$, then putting $a=exf$ and $b=fye$ you have that $ab=exffye=exyxye=e$ and $ba=fyeexf=fyxyxf=f$. 


Nothing here uses that you have a ring. You could work with semigroups and right $S$-sets. Then you are reducing to standard facts about Green's relations.


