Closed thijskuipers closed 6 years ago
Is there anyone looking into this issue? acquireToken is not working. To make it work we have to go back to version 1.0.15.
@thijskuipers @meng-han I apologize for the delayed response. I was busy working on the next generation of adal. Thank you for pointing out this issue. I have fixed it in the dev branch. Can you guys please take a look and confirm. I will plan on releasing a new version next week with this fix.
@rohitnarula7176 when will the fix be released?
@rohitnarula7176 Any news?
The issue still exists with 1.0.17.
I noticed that calling".
acquireToken()
withlogin_hint
(for silent token acquisition) always leads to the message "Loading frame has timed out after: 6 seconds for resourceI think the root cause is in method
saveTokenFromHash()
. Because the response contains both an access_token and id_token. Theresource
in this method is first derived from the stateResponse: https://github.com/AzureAD/azure-activedirectory-library-for-js/blob/f20a0ddde2faef87f87aae8e6aafe4de2c6b7a50/lib/adal.js#L1169But, when the response also contains an id_token, the
resource
is changed to the audience of the id_token, which is the Client Application and no longer the intended Resource Server: https://github.com/AzureAD/azure-activedirectory-library-for-js/blob/f20a0ddde2faef87f87aae8e6aafe4de2c6b7a50/lib/adal.js#L1218When at the end of the method the
RENEW_STATUS
for the resource is set toCOMPLETED
, this is done for theclientId
, not for theresourceUri
.This leads to the method
_loadFrameTimeout()
concluding that the token acquisition has timed out. https://github.com/AzureAD/azure-activedirectory-library-for-js/blob/f20a0ddde2faef87f87aae8e6aafe4de2c6b7a50/lib/adal.js#L590-L592Luckily, the callback was already executed and removed, so the error is not propagated. https://github.com/AzureAD/azure-activedirectory-library-for-js/blob/f20a0ddde2faef87f87aae8e6aafe4de2c6b7a50/lib/adal.js#L595-L597
I think the best solution would be to capture the resource of the
id_token
in a separate variable and not re-use the existingresource
variable in the methodsaveTokenFromHash()
.