Using gitlab application with self hosted versions of gitlab

I’m creating a gitlab application that I want all gitlab users to use wether on gitlab’s cloud or their self-hosted version of gitlab.

I’m following these guides:

So I created my application on and got the app id, I made the oauth url

enter image description here

and it works (notice that the above url is from gitlab where the app is made), now when I try to access that same url but for a self-hosted gitlab

enter image description here

So how can I make an app that works for self-hosted gitlab as well?