microsoft / MSCloudLoginAssistant

PowerShell Module Handling Authentication to Cloud Services
https://www.powershellgallery.com/packages/MSCloudLoginAssistant/
MIT License
76 stars 50 forks source link

Fix access token authentication type check #177

Closed FabienTschanz closed 2 weeks ago

FabienTschanz commented 2 months ago

@NikCharlebois This pull request fixes an issue where the check for access token authentication is misspelled. Instead of checking for AccessTokens as the authentication type, it's simply checked for AccessToken, which is not correct.


This change is Reviewable

FabienTschanz commented 1 month ago

@NikCharlebois Trying to raise the attention here, please have a look at it. Thank you.

FabienTschanz commented 3 weeks ago

@NikCharlebois Checking in to see if this can be reviewed soon. Thank you.

ericoevering commented 3 weeks ago

FabienTschanz thanks for pointing me in the right direction. i ended up changes a little more because i had problems with the secure value: from line 154

        elseif($Global:MSCloudLoginConnectionProfile.MicrosoftGraph.AuthenticationType -eq 'AccessTokens')
        {
            Write-Verbose -Message 'Connecting to Microsoft Graph with AccessToken'
            $SecureAccessToken = (ConvertTo-SecureString -String $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.AccessTokens[0] -AsPlainText -Force)
            Connect-MgGraph -Environment $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.GraphEnvironment `
                            -AccessToken $SecureAccessToken | Out-Null

Maybe it is not the best way to fix it but have a look at it.

FabienTschanz commented 3 weeks ago

@ericoevering Spot on, thank you for the hint. I missed that AccessToken must be a secure string. I implemented your proposed changes 👍