-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Authorization header removed after redirect #414
Comments
I believe this is by design of the
|
I have a registered IAuthenticator that adds the authorization header. Since it is registered with RestSharp rather than HttpWebRequest I think it's the responsibility of RestSharp to register the authenticator with HttpWebRequest. |
Ah, ok. Would you be interested in taking a crack at fixing it and submitting a pull request? |
I just stopped using the old URL. Most likely everyone does that. Until I find it necessary to use the redirect functionality I don't have any interest in fixing this. I already looked into it a little bit and it looks somewhat complicated because while the interface for System.Net.IAuthenticationModule and RestSharp.IAuthenticator are close, they are not compatible. |
Fair enough.
I have no idea what the rational is behind that. I bet a simple solution is just make the RestSharp implementation implement both interfaces. But I'll close this for now until someone else feels it's important enough. |
Hi, I am experiencing this issue. I am using calling an API which by the nature of their implementation uses redirects for their "friendly-urls" to the actual URL. On the redirect the authorization is lost. I'm not sure what the solution is? Thanks Paul |
You can either use the unfriendly-urls or implement the fix suggested by Haacked and me. |
You can just assign a CredentialsCache object to the request in the Authenticate method. From this msdn article:
So a RestSharp BasicAuthenticator implementation could look like this:
|
I'm not sure if this is supposed to be a feature because my other custom headers were preserved. Accept-Encoding is doubled on the second request as well.
First Request:
First Response:
Second Request:
The text was updated successfully, but these errors were encountered: