Authenticate to Common Data Service with the Web API
You must use OAuth as described in Use OAuth with Common Data Service.
The code you write to manage authentication when using the Web API depends on the type of deployment and where your code is.
Use the Common Data Service Web API
Web API types and operations
Perform operations using the Web API
Use OAuth with Common Data Service
Use OAuth with Cross-Origin Resource Sharing to connect a Single Page Application