Skip to content

Invoke-WebRequest should support preemptive Authentication #6012

Closed

Description

There are many HTTP APIs that don't follow RFC 2617 and don't respond with 401, instead they either return 200 and something with less information or 403 Forbidden.

There is currently no way to use Invoke-WebRequest -Credential and force preemptive authentication. The ugly workaround is to extract the password from the SecureString of the Credential and converting it to the base64 encoded Authorization Header manually.

With #5052 direct support was added for BasicAuth, but it still misses the option for preemptive authentication.

I'd suggest to use either -PreemptiveAuthentication or -ForceAuthentication as new parameters for this feature.

Activity

  1. markekraus commented on Jan 24, 2018

    @markekraus
    Contributor

    Leonard Brünings (@leonard84) When you use use the -Authorization basic -Credential $Credential, the Authorization: Basic <Base64(user:password)> is sent explicitly without first checking for a 403 response.

    More info https://get-powershellblog.blogspot.com/2017/12/powershell-core-web-cmdlets-in-depth_24.html#L06

  2. added
    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
    on Jan 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-AnsweredThe question is answered.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions