chore(oidc error): expose actual error information #2172

Merged
Aranjedeath merged 1 commit from kyle/continuwuity:no-swallow-oidc-error into main 2026-08-25 00:14:49 +00:00
Contributor

This pull request exposes the actual error information behind the current generic OIDC "failed to parse" message:

 ERROR conduwuit_service::oidc: Failed to exchange OIDC authorization code: \n
-Failed to parse server response
+Failed to parse server response (Parse(Error { path: Path { segments: [] }, original: Error("Invalid JSON web token: found 5 parts (expected 3)", line: 1, column: 6188) }, [123, 34, ..., 34, 125]))
     at src/service/oidc/mod.rs:283 on conduwuit:worker ThreadId(7)
     in tower_sessions::service::call

This issue was created by my provider configuration, but made impossible to debug by swallowing error information even at TRACE log level.

Pull request checklist:

  • This pull request targets the main branch, and the branch is named something other than
    main.
  • I have written an appropriate pull request title and my description is clear.
  • I understand I am responsible for the contents of this pull request.
  • I have followed the contributing guidelines:
This pull request exposes the actual error information behind the current generic OIDC "failed to parse" message: > ```diff > ERROR conduwuit_service::oidc: Failed to exchange OIDC authorization code: \n > -Failed to parse server response > +Failed to parse server response (Parse(Error { path: Path { segments: [] }, original: Error("Invalid JSON web token: found 5 parts (expected 3)", line: 1, column: 6188) }, [123, 34, ..., 34, 125])) > at src/service/oidc/mod.rs:283 on conduwuit:worker ThreadId(7) > in tower_sessions::service::call > ``` This issue was created by my provider configuration, but made impossible to debug by swallowing error information even at TRACE log level. **Pull request checklist:** <!-- You need to complete these before your PR can be considered. If you aren't sure about some, feel free to ask for clarification in #dev:continuwuity.org. --> - [x] This pull request targets the `main` branch, and the branch is named something other than `main`. - [x] I have written an appropriate pull request title and my description is clear. - [x] I understand I am responsible for the contents of this pull request. - I have followed the [contributing guidelines][c1]: - [x] My contribution follows the [code style][c2], if applicable. - [x] I ran [pre-commit checks][c1pc] before opening/drafting this pull request. - [x] I have [tested my contribution][c1t] (or proof-read it for documentation-only changes) myself, if applicable. This includes ensuring code compiles. - [x] My commit messages follow the [commit message format][c1cm] and are descriptive. [c1]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md [c2]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/docs/development/code_style.mdx [c1pc]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md#pre-commit-checks [c1t]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md#running-tests-locally [c1cm]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md#commit-messages
Author
Contributor

For future readers (perhaps including myself):

Failed to exchange OIDC authorization code: Failed to parse server response

The cause of this error, in my case, was configuring a Authentik provider with both signing† and encryption‡.

Un-configuring the encryption key‡ (setting it to "-----") resolved this issue.


† OpenID provider > Signing Key
‡ OpenID provider > Advanced Protocol Settings > Encryption Key

_For future readers (perhaps including myself):_ > Failed to exchange OIDC authorization code: Failed to parse server response The cause of this error, in my case, was configuring a Authentik provider with **both** signing† and encryption‡. Un-configuring the encryption key‡ (setting it to "-----") resolved this issue. --- † OpenID provider > Signing Key ‡ OpenID provider > Advanced Protocol Settings > Encryption Key
@ -281,3 +281,3 @@
.await
.map_err(|err| {
error!("Failed to exchange OIDC authorization code: {err}");
error!("Failed to exchange OIDC authorization code: {err} ({:?})", err);
Owner

It might be cleaner to just

error!(error=?err, "Failed to exchange OIDC authorization code")
It might be cleaner to just ```rs error!(error=?err, "Failed to exchange OIDC authorization code") ```
Author
Contributor

Yes it is, and still shows the error info

ERROR conduwuit_service::oidc: Failed to exchange OIDC authorization code, error: Parse(Error { path: Path { segments: [] }, original: Error("Invalid JSON web token: found 5 parts (expected 3)", line: 1, column: 6188) }, [123, 34, ..., 34, 125])
    at src/service/oidc/mod.rs:283 on conduwuit:worker ThreadId(3)
    in tower_sessions::service::call

Changing to this

Yes it is, and still shows the error info > ``` > ERROR conduwuit_service::oidc: Failed to exchange OIDC authorization code, error: Parse(Error { path: Path { segments: [] }, original: Error("Invalid JSON web token: found 5 parts (expected 3)", line: 1, column: 6188) }, [123, 34, ..., 34, 125]) > at src/service/oidc/mod.rs:283 on conduwuit:worker ThreadId(3) > in tower_sessions::service::call > ``` Changing to this
kyle marked this conversation as resolved
kyle force-pushed no-swallow-oidc-error from 46ed826ad0
Some checks failed
Auto Labeler / Apply labels based on changed files (pull_request_target) Successful in 3s
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 7s
Documentation / Build and Deploy Documentation (pull_request) Has been cancelled
Checks / Prek / Pre-commit & Formatting (pull_request) Has been cancelled
Checks / Prek / Check changed files (pull_request) Has been cancelled
Checks / Prek / Clippy and Cargo Tests (pull_request) Has been cancelled
to f1dc218c22
Some checks failed
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 6s
Documentation / Build and Deploy Documentation (pull_request) Has been cancelled
Checks / Prek / Pre-commit & Formatting (pull_request) Has been cancelled
Checks / Prek / Check changed files (pull_request) Has been cancelled
Checks / Prek / Clippy and Cargo Tests (pull_request) Has been cancelled
2026-08-23 21:04:34 +00:00
Compare
kyle force-pushed no-swallow-oidc-error from f1dc218c22
Some checks failed
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 6s
Documentation / Build and Deploy Documentation (pull_request) Has been cancelled
Checks / Prek / Pre-commit & Formatting (pull_request) Has been cancelled
Checks / Prek / Check changed files (pull_request) Has been cancelled
Checks / Prek / Clippy and Cargo Tests (pull_request) Has been cancelled
to 6078a0d792
All checks were successful
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 7s
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Check changed files (pull_request) Successful in 7s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 1m20s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 8m14s
2026-08-24 05:24:16 +00:00
Compare
ginger approved these changes 2026-08-24 13:06:39 +00:00
kyle deleted branch no-swallow-oidc-error 2026-08-25 02:21:15 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
continuwuation/continuwuity!2172
No description provided.