Skip to content

Instantly share code, notes, and snippets.

@ImranCodeBug
Created September 8, 2019 14:13
Show Gist options
  • Save ImranCodeBug/4bb8e99c0267dbed201fbe93ca2f3188 to your computer and use it in GitHub Desktop.
Save ImranCodeBug/4bb8e99c0267dbed201fbe93ca2f3188 to your computer and use it in GitHub Desktop.
AdalContext file that captures all the call token call to AAD
import {AuthenticationContext} from 'react-adal'
import AdalConfig from '../Configs/AdalConfig'
export const authContext = new AuthenticationContext(AdalConfig);
export const acquireToken = (func) =>
authContext.acquireToken(AdalConfig.endpoints.api, func);
export const getToken = (fnc) =>{
if(authContext.getCachedUser() == null){
authContext.login();
}
authContext.acquireToken(AdalConfig.endpoints.api, fnc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment