-
Notifications
You must be signed in to change notification settings - Fork 38
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
OAuth over proxy does not work #841
Comments
Currently, the request for the OAuth2 token does not use a proxy. I use neither the proxy of the actual request nor the one from the environment (HTTP_PROXY). The idea was to add the proxy or other values using the variable
Would a variable oauth2_proxy help, which configures the proxy? Always using the proxy of the actual request also feels wrong, doesn't it? I have too little experience of how proxies are used in company networks. |
@AnWeber You do not want to know how some companies use proxies. :-) The things we run into are crazy. And they are very difficult to troubleshoot. Anyway, you are right: authorization endpoint may have a totally different proxy requirement from the actual endpoint. At least, in theory. However, based on my experience, in practice, they are mostly the same. I can't think of any case, where they would be different. Also, generally, endpoints that do not need a proxy can be accessed via a proxy (this may involve a bit of overhead, so IT may not appreciate it as a policy, but generally, the calls to internal sites should work over proxy). Here is the combination of proxy configurations that need to be allowed:
In my mind (and I may be wrong), the preferred behavior for the oauth calls would be:
So, your suggestion to add the Another thing to keep in mind is that for the |
Thinking of the
Or mark it as an auth token generation request:
Or something like this. I haven't given this a lot of thought, though, so there may be better ways. |
I am not convinced by the special treatment for Bearer Request. It is also possible to set the proxy manually in this way at any time.
I would not implement it right now. Proxy support is implemented with next version |
This is a CLI problem only. In the VSCode extension, everything works fine.
ENVIRONMENT
BACKGROUND
We have a cloud hosted REST endpoint which is exposed directly (for testing) and also via Apigee (for consumption by other apps). The endpoint uses OAuth 2.0 with the
client_credentials
flow. The OAuth token URL points to Apigee, but Apigee internally calls the token endpoint in the original cloud, so the bearer token can be obtained from either Apigee (when consumed by other apps) or the cloud endpoint (intended for testing only). The Apigee URLs look like they are company URLs (the host part ends with the company domain), but they resolve to external IPs and need to be accessed via a proxy.PROXY
Here is the proxy requirements matrix:
I can obtain a bearer token from the cloud without using a proxy, but for everything else, a proxy is required.
PROBLEM
When I use CLI to test an API in Apigee (and using OAuth 2.0 settings pointing to the token endpoint in Apigee), requests time out with error:
The XX.XXX.XXX.XXX IP address points to the Apigee (Google) IP address (I assume it is the IP address of the Apigee token endpoint).
WORKAROUND
I figured out two workarounds:
oauth2
authorization, useBearer
with token generated in a referenced test, so, all tests would have a dependency on a test that generates a token from the Apigee token endpoint (this would be allowed, but it would complicate the code because it would only be required for the CLI execution).Neither workaround is a permanent solution, so hopefully this issue gets fixed.
IMPACT
Majority of our APIs (not just our team's APIs, the whole company) are either behind Apigee or a similar solution, so it affects pretty much every API.
SUMMARY
Since I can generate a bearer token from the Apigee token endpoint explicitly (using a proxy), the fact that the calls timeout, when a test uses the
oauth2
authorization against the same Apigee token endpoint, suggests that the implicitoauth2
authorization call somehow forgets to use the specified proxy settings. Ideally, the OAuth call should allow a separate proxy configuration, but at the very least, it needs to recognize the primary (request) proxy configuration.The text was updated successfully, but these errors were encountered: