Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check response status code for credential calls #270

Closed
ctaggart opened this issue May 28, 2021 · 1 comment
Closed

check response status code for credential calls #270

ctaggart opened this issue May 28, 2021 · 1 comment
Labels
Azure.Identity The azure_identity crate

Comments

@ctaggart
Copy link
Contributor

Adding per #266 (comment). A couple of places in a azure_identity use reqwest directly. They issue a HTTP request, but do not check for a successful error code. Certain errors will have an error response that can be deserialized. In most cases, I'm not sure it is worth trying to deserialize an error message.

sdk\identity\src\device_code_flow\mod.rs
sdk\identity\src\client_credentials_flow\mod.rs

    client
        .post(url)
        .header("ContentType", "Application / WwwFormUrlEncoded")
        .body(encoded)
        .send()
        .await?
        .text()
        .await
        .map(|s| -> Result<LoginResponse, Error> {
            Ok(serde_json::from_str::<LoginResponse>(&s)?)
        })?
    // TODO The HTTP status code should be checked to deserialize an error response.
    // serde_json::from_str::<crate::errors::ErrorResponse>(&s).map(Error::ErrorResponse)
@cataggar cataggar added the Azure.Identity The azure_identity crate label Oct 26, 2021
@cataggar cataggar added this to the azure_identity 0.1.0 milestone Oct 26, 2021
@cataggar
Copy link
Member

This was fixed in #544.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Identity The azure_identity crate
Projects
None yet
Development

No branches or pull requests

2 participants