title: Handle connection Azure AD with ADAL in react
body: <p>I made an application in react and i'm using ADAL to authenticate in Azure Active Directory, so every time someone go to my site he has to log in. </p>
  
  <p>I have to log (send a POST request to my API) all the connections and deconnections (when the user click on the button log out).</p>
  
  <p>The authentication is managed by ADAL , so i don't know where to put my code to handle this...</p>
  
  <pre><code>import { AuthenticationContext, adalFetch, withAdalLogin } from 'react-adal';
  
  export const adalConfig = {
      instance: 'https://login.microsoftonline.com/',
      tenant: '3v824f55-8461-4eab-9659-81cce12dfa04',
      clientId: '33h87014-dff8-4406-84ce-2608f7173fe2',
      endpoints: {
          api: '14653b62-d8444-4e7a-9362-d7267et30a0d',
      },
      postLogoutRedirectUri: window.location.origin,
      cacheLocation: 'localStorage',
      callBack:callBackFunction
  };
  
  
  export const authContext = new AuthenticationContext(adalConfig);
  
  export const adalApiFetch = (fetch, url, options) =&gt;
    adalFetch(authContext, adalConfig.endpoints.api, fetch, url, options);
  
  export const withAdalLoginApi = withAdalLogin(authContext, adalConfig.endpoints.api);
  
  function callBackFunction(errorDesc, token, error, tokenType)
  {`enter code here`
    alert("Problem wit`enter code here`h the connection ! ");
  }
  
  export const getToken = () =&gt; {
    return authContext.getCachedToken(authContext.config.clientId);
  };
  </code></pre>
  
  <p>Here is my adal.config file (that's not the true values)</p>
  
  <p>Does anyone has any ideas or have ever encountered this issue ?</p>
  
  <p>Thanks in advance :) </p>