Skip to content

[suggestion] Provide clearer error messages for client-side authentication failures (4xx) #370

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

Open
LeoCBS opened this issue Apr 10, 2025 · 1 comment

Comments

@LeoCBS
Copy link

LeoCBS commented Apr 10, 2025

Hello,

It seems that the auth crate doesn't properly parse response errors when the authentication configuration is invalid.
I was trying to use GKE Workload Identity as the auth method behind the with_auth() function, and the crate just returned a decode error (probably because the response wasn't what the decoder expected), which made debugging my configuration more difficult.

What do you think about returning a clearer error message for client auth errors? Does that make sense?
I’d be happy to open a PR with this suggestion if you're open to it.

HttpError(reqwest::Error { kind: Decode, source: Error("expected value", line: 1, column: 1) })

Just to clarify, Workload Identity on GKE works fine, this suggestion is only about improving the clarity of error messages in such cases.

@yoshidan
Copy link
Owner

I agree with including the request URL and bytes of the response body in the error, as it is difficult to investigate whether that error actually occurred.

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

No branches or pull requests

2 participants