-
Notifications
You must be signed in to change notification settings - Fork 988
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
oauth2 doesn't follow 301 redirects #177
Comments
HTTP client is automatically following 301s unless Client.CheckRedirect says otherwise. It is unlikely that it is coming from https://github.com/golang/oauth2/blob/master/internal/token.go#L176. Are you sure that the http.Client you are using is not disabling redirects? |
Hmm.. my code doesn't set CheckRedirect so it is using the default policy. Apparently neither does oauth2. I checked out rclone and all its dependencies into a clean GOPATH and grepped them. There were no uses of CheckRedirect. If it had been a redirect loop then it should have produced this error
Any other ideas? Thanks Nick |
Is this a GET request or is it your custom error message? I am assuming you are experiencing this at https://github.com/golang/oauth2/blob/master/internal/token.go#L149 and I don't think POST requests are being redirected according to https://github.com/golang/go/blob/2af00eb63cde716b59c0d64f4c3855b83a9d5a63/src/net/http/client.go#L365. |
HTTP 301 dictates that the client retries the request at another location with the To redirect that respects the request method, the server should issue a |
This was fixed in: https://go-review.googlesource.com/c/go/+/29852/ and this issue can be closed I think. |
I'm using oauth2 very succesfully in rclone (rclone.org). I'm having trouble with the hubic implementation though. It works perfectly nearly all the time, but every now and again it returns this error when it tries to refresh the token.
I think this error is probably coming from here.
I don't know whether this is a problem with Hubic being out of spec or this library - any help much appreciated!
You can see my code here with the utility library here.
The text was updated successfully, but these errors were encountered: