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

Open
kyle wants to merge 1 commit from kyle/continuwuity:no-swallow-oidc-error into main
First-time 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 this information being hidden 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 this information being hidden 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
chore(oidc error): expose actual error information
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
46ed826ad0
Author
First-time 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
First-time 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
Some checks are pending
Documentation / Build and Deploy Documentation (pull_request) Blocked by required conditions
Checks / Prek / Pre-commit & Formatting (pull_request) Blocked by required conditions
Checks / Prek / Check changed files (pull_request) Blocked by required conditions
Checks / Prek / Clippy and Cargo Tests (pull_request) Blocked by required conditions
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 7s
2026-08-24 05:24:16 +00:00
Compare
Some checks are pending
Documentation / Build and Deploy Documentation (pull_request) Blocked by required conditions
Checks / Prek / Pre-commit & Formatting (pull_request) Blocked by required conditions
Required
Details
Checks / Prek / Check changed files (pull_request) Blocked by required conditions
Required
Details
Checks / Prek / Clippy and Cargo Tests (pull_request) Blocked by required conditions
Required
Details
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 7s
Required
Details
Some required checks are missing.
Some workflows are waiting to be reviewed.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u no-swallow-oidc-error:kyle-no-swallow-oidc-error
git switch kyle-no-swallow-oidc-error
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 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.