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

Handle customer proxy re-auth response by retrying, not prompting user for different token #6652

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sqs
Copy link
Member

@sqs sqs commented Jan 15, 2025

A customer has a proxy that enforces recent 2fa on their machines to access the Sourcegraph instance. After 24h, the user needs to tap their 2fa key to make the network connection to Sourcegraph be reauthed and start working again. The responses from the proxy after the 24h period expires are being treated as "invalid token" and causing users to need to re-auth into Cody. The response looks like:

{"auth_url":"https://example.com","error":"request not authenticated","requested_url":"example.com/.api/client-config"}

  • Send Accept: application/json headers to ensure we get that JSON response and not an HTTP redirect from the proxy when the 24h period expires
  • Interpret that (or that kind of) JSON response in our auth code as a "keep retrying" not "show user that token is invalid" (TODO NOT DONE)

Fixes https://linear.app/sourcegraph/issue/CODY-4695/handle-customer-proxy-re-auth-response-by-retrying-not-prompting-user

Test plan

TODO

@sqs sqs marked this pull request as draft January 15, 2025 18:35
@sqs sqs changed the title add narrower Accept: application/json header to outgoing HTTP requests Handle customer proxy re-auth response by retrying, not prompting user for different token Jan 15, 2025
For customers whose Sourcegraph instance is proxied by a custom proxy that expects this header for API requests.
@sqs sqs force-pushed the sqs/client-config-accept branch from 9d22d3b to 762eee1 Compare January 16, 2025 00:47
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

Successfully merging this pull request may close these issues.

1 participant