mbegan / Okta-PSModule

Okta API Powershell Wrapper Module
Other
102 stars 31 forks source link

invoke-webrequest *IE Fix* add the command "-UseBasicParsing" to the end #35

Open zsirkin opened 5 years ago

zsirkin commented 5 years ago

In case you haven't done this in the latest update (I have yet to update mine), I recommend updating your 2 invoke-webrequest lines to include "-UseBasicParsing" so that we don't have to expect that the logged in user has ever opened IE: ORIGINAL:

            $request2 = Invoke-WebRequest -Uri $uri -Method $method -UserAgent $userAgent -Headers $headers `
                        -ContentType $contentType -Verbose:$oktaVerbose -Body $postData -ErrorVariable evar       
        } else {
            $request2 = Invoke-WebRequest -Uri $uri -Method $method -UserAgent $userAgent -Headers $headers `
                        -ContentType $contentType -Verbose:$oktaVerbose -ErrorVariable evar 

NEW:

           $request2 = Invoke-WebRequest -Uri $uri -Method $method -UserAgent $userAgent -Headers $headers `
                        -ContentType $contentType -Verbose:$oktaVerbose -Body $postData -ErrorVariable evar -UseBasicParsing      
        } else {
            $request2 = Invoke-WebRequest -Uri $uri -Method $method -UserAgent $userAgent -Headers $headers `
                        -ContentType $contentType -Verbose:$oktaVerbose -ErrorVariable evar -UseBasicParsing

The idea came from here after we had issues with it not working for users on servers... https://github.com/PowerShell/Polaris/issues/90

As always, thanks for everything!!

Zach

rob-traynere-tylertech commented 1 year ago

thanks for this fix. I imagine this will effect more and more people attempting to use this module.