Skip to content

Fix login to support auth-required OpenProject instances#9

Merged
cbliard merged 1 commit intomainfrom
fix/make-login-command-support-auth-required-instances
Apr 20, 2026
Merged

Fix login to support auth-required OpenProject instances#9
cbliard merged 1 commit intomainfrom
fix/make-login-command-support-auth-required-instances

Conversation

@cbliard
Copy link
Copy Markdown
Member

@cbliard cbliard commented Apr 20, 2026

Currently, logging in on an OpenProject instance which requires auth fails with an error:

./op --verbose login
[DEBUG] Parsing host URL ...
OpenProject host URL: https://someinstance.openproject.eu/
[DEBUG] Parsed input "https://someinstance.openproject.eu\n".
[DEBUG] Sanitizing input ...
[DEBUG] Sanitized input 'https://someinstance.openproject.eu/'.
[DEBUG] Parsing input as url ...
[DEBUG] Parsed url 'https://someinstance.openproject.eu/'.
[DEBUG] Checking for http host and scheme ...
[DEBUG] Parsing input successful, continuing with next steps.
[DEBUG] Initializing requests client ...
[DEBUG] Fetching API root to check for instance configuration ...
[DEBUG] Building HTTP request:
[DEBUG] with Method: GET
[DEBUG] with Path: /api/v3
[DEBUG] with Query:
[DEBUG] with Body:
[DEBUG] Running HTTP request GET https://someinstance.openproject.eu/api/v3
[ERROR] URL does not point to a valid OpenProject instance.

This happens because the /api/v3 replies with 401.

This PR fixes this issue:

  • Add requests.Probe() to perform unauthenticated HTTP requests without treating non-2xx responses as errors
  • Update checkOpenProjectApi() to accept 401 responses from instances that require authentication on /api/v3, detecting OpenProject via the Link header or error identifier
  • Fix API token URL from /my/access_token to /my/access_tokens

- Add requests.Probe() to perform unauthenticated HTTP requests without
  treating non-2xx responses as errors
- Update checkOpenProjectApi() to accept 401 responses from instances
  that require authentication on /api/v3, detecting OpenProject via the
  Link header or error identifier
- Fix API token URL from /my/access_token to /my/access_tokens
@cbliard cbliard force-pushed the fix/make-login-command-support-auth-required-instances branch from 72aa58e to a8867da Compare April 20, 2026 09:57
@cbliard cbliard requested a review from Kharonus April 20, 2026 09:59
cbliard referenced this pull request Apr 20, 2026
- Add requests.Probe() to perform unauthenticated HTTP requests without
  treating non-2xx responses as errors
- Update checkOpenProjectApi() to accept 401 responses from instances
  that require authentication on /api/v3, detecting OpenProject via the
  Link header or error identifier
- Fix API token URL from /my/access_token to /my/access_tokens
Copy link
Copy Markdown
Member

@Kharonus Kharonus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall a nice addition, thanks!

@cbliard cbliard merged commit 6586e31 into main Apr 20, 2026
4 checks passed
@cbliard cbliard deleted the fix/make-login-command-support-auth-required-instances branch April 20, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants