Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Error: Get-MsalToken : Cannot convert 'System.Object[]' to the type 'System.Exception' required by parameter 'Exception'. Specified method is not supported. #53

Open
markdomansky opened this issue Apr 4, 2022 · 0 comments

Comments

@markdomansky
Copy link

I am starting to get these errors occasionally.
I use the disk cache, but clearing the disk cache does not resolve it.

PS> $token = Get-GraphDelegatedToken -ApplicationID $clientid -Verbose:$false
Get-MsalToken : Cannot convert 'System.Object[]' to the type 'System.Exception' required by parameter 'Exception'. Specified method is not supported.
At C:\ps\data\local\modules\msal.ps\4.37.0.0\Get-MsalToken.ps1:293 char:49
+ ... ionResult = Get-MsalToken -Silent -PublicClientApplication $PublicCli ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-MsalToken], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Get-MsalToken

I've been able to temporarily work around this issue by changing this line 299 on get-msaltoken from:

catch [Microsoft.Identity.Client.MsalUiRequiredException] {

to:

catch  {

I know that probably isn't a valid fix, but it at least gets me going and might help others. I haven't noticed any negative side-effects.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant