Azure-Samples/ms-identity-b2c-javascript-spa

Auth Redirect is not working properly

chdalski opened this issue · 2 comments

Hi there,

the function "Acquires and access token and then passes it to the API call"
function passTokenToApi() { getTokenRedirect(tokenRequest); if (accessToken) { try { callApi(apiConfig.webApi, accessToken); } catch(error) { console.warn(error); } } }
in ms-identity-b2c-javascript-spa/App/authRedirect.js is not working as expected.

It should be something like:
function passTokenToApi() { getTokenRedirect(tokenRequest).then(response => { if (response.accessToken) { try { callApi(apiConfig.webApi, response.accessToken); } catch (error) { console.warn(error); } } }); }

@chdalski excellent catch! Will update ASAP.

@chdalski I've updated the sample and the issue should be resolved, but let us know if not.