For your scenario, you will need Dynamics CRM licenses for all your users as per stated in the licensing guide. The quote from the guide is below. This is regardless of whether it is on-premise or online version.
Dynamics 365 licenses are required for users or devices that directly input, query, or view data from the Dynamics 365 service. Similarly, Dynamics 365 licenses are required for users or devices that input data into, query, or view data from the Dynamics 365 service through a pooling device. Pooled connections use a non-interactive user account in Dynamics 365 that can access the system but only via the web service layer. Internal users and devices accessing Dynamics 365 data indirectly through a portal or via an API to a separate service must also be properly licensed, regardless of if they are set up as a Dynamics 365 user in the service, for example:
• Internal users and devices accessing Dynamics 365 restricted data indirectly through a Power Apps must still be properly licensed for Dynamics 365
• Any user or device that accesses the service, files, data, or content provided by the service that is made available through an automated process requires a Dynamics 365 license
• The number of tiers of hardware or software between the Dynamics 365 service and the user or devices that ultimately use its data, services, or functionality does not affect the number of SLs required.