Generalized Likelihood Ratio Test for $p_1=p_2$ when $X_1\sim \text{Bin} (n_1,p_1)$ and $X_2\sim\text{Bin}(n_2,p_2)$ Let $X_1\sim \text{Bin} (n_1,p_1)$, $X_2\sim\text{Bin}(n_2,p_2)$ be two independent random variables.
I am trying to find the Generalized Likelihood Ratio Test for the the null hypothesis:
$$H_{0}: p_1=p_2$$
The only thing I could come up with is under the null I know that $X_1+X_2\sim \text{Bin}(N=n_1+n_2,p)$.
Then I can find my size $\alpha$ test by finding the  values $K_1, K_2$ such that
$$P(X_1+X_2\le K_1)\le \frac{\alpha}{2}$$ and $$P(X_1+X_2\ge K_2)\le \frac{\alpha}{2}.$$
I am just wondering  if this  is the right approach or if is there another approach that gets me my GLT.
Update from comments below:
Then my ratio becomes:
$$\frac{(1-\bar{X})^{n_1+n_2-2x}\bar{X}^{2x}}{(1-\bar{X}_1)^{n_1-x}(1-\bar{X}_2)^{n_1-x}(\bar{X}_1\bar{X}_2)^x}$$
 A: Assuming $n_1,n_2$ are known, the likelihood function given $(X_1,X_2)=(x_1,x_2)$ is
$$L(p_1,p_2\mid x_1,x_2)=c\,p_1^{x_1}(1-p_1)^{n_1-x_1}p_2^{x_2}(1-p_2)^{n_2-x_2}\,,$$
where $c$ is a constant free of $(p_1,p_2)$.
Unrestricted MLE of $(p_1,p_2)$ is $$(\hat p_1,\hat p_2)=\left(\frac{X_1}{n_1},\frac{X_2}{n_2}\right)$$
Restricted MLE of $(p_1,p_2)$ under $H_0:p_1=p_2$ is $$(\tilde p_1,\tilde p_2)=\left(\frac{T}{n},\frac{T}{n}\right)\,,$$
where $T=X_1+X_2$ and $n=n_1+n_2$.
Suppose the alternative hypothesis is $H_1:p_1\ne p_2$.
The likelihood ratio test criterion is then
$$\Lambda(x_1,x_2)=\frac{L(\tilde p_1,\tilde p_2\mid x_1,x_2)}{L(\hat p_1,\hat p_2\mid x_1,x_2)}=\frac{\left(\frac{T}{n}\right)^T\left(1-\frac{T}{n}\right)^{n-T}}{\left(\frac{x_1}{n_1}\right)^{x_1}\left(1-\frac{x_1}{n_1}\right)^{n_1-x_1}\left(\frac{x_2}{n_2}\right)^{x_2}\left(1-\frac{x_2}{n_2}\right)^{n_2-x_2}}$$
A likelihood ratio test rejects $H_0$ if $\Lambda<k$, which is equivalent to $g(X_1,X_2)>h(T)$ where
$$g(X_1,X_2)=\left(\frac{X_1}{n_1}\right)^{X_1}\left(1-\frac{X_1}{n_1}\right)^{n_1-X_1}\left(\frac{X_2}{n_2}\right)^{X_2}\left(1-\frac{X_2}{n_2}\right)^{n_2-X_2}$$ and $h$ is some function of $T$.
