First of all the App must be registered. For Registration Please refer this link : How to Register Dynamics CRM App with Azure Active Directory.
Then the Config is passed into AuthenticationContext. After that login function is called and the browser is redirected to Microsoft online login page.
After login, browser is redirected back to the page along with Authentication Token
authContext.AcquireToken(resourceURL,callback) function is used to acquire Access Token to access Dynamics CRM Web API.
When the Access Token is Acquired, we can use it to call or access Dynamics CRM.