Created
September 8, 2019 14:13
-
-
Save ImranCodeBug/4bb8e99c0267dbed201fbe93ca2f3188 to your computer and use it in GitHub Desktop.
AdalContext file that captures all the call token call to AAD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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