Skip to content

Conversation

@Excellencedev
Copy link

Summary

Fixes #143 - OIDC login fails with Authelia due to missing state parameter.

Problem

Authelia requires the state parameter in OIDC authorization requests (minimum 8 characters for entropy). The previous implementation didn't include this parameter, causing invalid_state errors.

Changes

  • Added generate_state/0 function to create cryptographically secure 32-byte state values
  • Store state in session alongside PKCE verifier during authorization
  • Validate returned state matches stored state on callback (CSRF protection)
  • Include state parameter in Oidcc.create_redirect_url options

/claim #143

@Excellencedev
Copy link
Author

@alxlion Please review. I believe this fixes it

@Excellencedev

This comment was marked as outdated.

google-labs-jules bot and others added 2 commits December 8, 2025 05:36
This commit introduces the `state` parameter to the OIDC authentication flow to prevent CSRF attacks. The changes include generating a random state value, storing it in the session, and verifying it in the callback.

This resolves an issue where OIDC login with Authelia would fail due to the missing `state` parameter.
,
@Excellencedev
Copy link
Author

Excellencedev commented Dec 8, 2025

code formatted, builds,and test pass. ci should pass

@Excellencedev
Copy link
Author

@alxlion plz review

@alxlion
Copy link
Contributor

alxlion commented Dec 16, 2025

@alxlion Please review. I believe this fixes it

I don't want you to believe, you have to be sure. Have you tested it and confirmed that it's working?

@Excellencedev
Copy link
Author

@alxlion Let me go ahead and test it

@Excellencedev
Copy link
Author

drafting til then

@Excellencedev Excellencedev marked this pull request as draft December 16, 2025 14:02
@Excellencedev Excellencedev marked this pull request as ready for review December 20, 2025 02:52
@Excellencedev
Copy link
Author

@alxlion pls approve workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Authelia OICD login fails due to missing state value

2 participants