Oauth token endpoint not working

Maybe this is my mistake somewhere, but after I get authorization code and try to request a token via https://gitlab.com/oauth/token I get 404. Documentation does not state precisely which url I should use (there is “gitlab.example.com/oauth/token”), but I have used gitlab.com/oauth/authorize and it worked.