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 gitlab.com and got the app id, I made the oauth url

https://gitlab.com/oauth/authorize?client_id=6b7979bc2dbd78444592e30d624aa37fc0fc2c9145f3af44f1f70f5c4adbf21d&redirect_uri=http://redirect.url/example&response_type=code&state=your_unique_state_hash

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

https://gitlab.project.com/oauth/authorize?client_id=6b7979bc2dbd78444592e30d624aa37fc0fc2c9145f3af44f1f70f5c4adbf21d&redirect_uri=http://redirect.url/example&response_type=code&state=your_unique_state_hash

enter image description here

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