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.
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).
The authentication is managed by ADAL , so i don't know where to put my code to handle this...
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) =>
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 = () => {
return authContext.getCachedToken(authContext.config.clientId);
};
Here is my adal.config file (that's not the true values)
Does anyone has any ideas or have ever encountered this issue ?
Thanks in advance :)
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)