Is it possible to access WebAPI on dynamics 365 on-premise without using Azure?

can we create credentials to generate a bearer token in custom without using Azure?