AzureAD / MSAL.PS

MIT License
159 stars 29 forks source link

Exception calling "ExecuteAsync" with "0" argument(s): "No account or login hint was passed to the AcquireTokenSilent call. #9

Closed DarkLite1 closed 4 years ago

DarkLite1 commented 4 years ago

First of all thank you for this wonderful wrapper around msal, it really helped simplifying some of our code. Retrieving a token works flawless like this:

$msalParams = @{
    ClientId = $azureClientId
    TenantId = $azureTenantId 
    Scopes   = "https://outlook.office.com/EWS.AccessAsUser.All"
}
$token = Get-MsalToken @msalParams

But for longer running scripts and calling this CmdLet multiple times we sometimes get this error message:

No account or login hint was passed to the AcquireTokenSilent call. Exception calling "ExecuteAsync" with "0" argument(s): "No account or login hint was passed to the AcquireTokenSilent call."

After some investigation I found a similar treat here but I can't seem to make the error disappear. Are we doing something wrong?

Thank you for your help.

DarkLite1 commented 4 years ago

Apparently it fixes itself when adding the switch -IntegratedWindowsAuth.

Sorry about that, this one can be closed.