Skip to content

feat: implement OAuth 2.0 authorization flow with TimeHarbor integration#172

Open
Dharp02 wants to merge 4 commits into
mainfrom
integration
Open

feat: implement OAuth 2.0 authorization flow with TimeHarbor integration#172
Dharp02 wants to merge 4 commits into
mainfrom
integration

Conversation

@Dharp02
Copy link
Copy Markdown
Collaborator

@Dharp02 Dharp02 commented May 15, 2026

This pull request adds support for acting as an OpenID Connect (OIDC) provider, enabling OAuth 2.0 Authorization Code flows for integration with trusted clients like TimeHarbor. It introduces the OIDC provider plugin, configures trusted client details, and ensures the correct handling of URL-encoded bodies required by OIDC endpoints. Additionally, it updates the frontend to support seamless OAuth flows by forwarding authorization parameters and session tokens as needed.

OIDC Provider Integration and Configuration:

  • Added the oidcProvider plugin to the betterAuth setup in auth.ts, registering TimeHarbor as a trusted OAuth client and configuring the login page, client secrets, and consent skipping.

Backend Request Handling Improvements:

  • Updated server.ts to accept application/x-www-form-urlencoded bodies (used by OIDC token endpoints) and forward them as raw strings to the authentication handler, ensuring compatibility with OIDC flows.
    Frontend OAuth Flow Support:

  • Modified main.tsx to detect OAuth 2.0 authorization parameters in the URL and, if the user is authenticated, forward them (along with the session token in a cookie) to the OIDC authorization endpoint.

  • Updated LoginForm.tsx so that after a successful sign-in initiated by an OAuth 2.0 authorization request, the app redirects back to the authorization endpoint, copying the session token into a cookie for Better Auth to recognize the session.

@Dharp02 Dharp02 self-assigned this May 15, 2026
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