Skip to content

Add configurable sign_in_path redirect for unauthenticated users#37

Merged
HamptonMakes merged 1 commit intomainfrom
engine-sign-in-redirect
Mar 3, 2026
Merged

Add configurable sign_in_path redirect for unauthenticated users#37
HamptonMakes merged 1 commit intomainfrom
engine-sign-in-redirect

Conversation

@HamptonMakes
Copy link
Collaborator

The engine's authenticate_coplan_user! was returning a bare 401 Unauthorized when the auth callback returned nil. For host apps with a login page (like this dev host), users should be redirected to sign in instead.

Changes

  • Add sign_in_path config option to CoPlan::Configuration
  • Redirect to sign_in_path when set, fall back to head :unauthorized for API-only hosts
  • Configure /sign_in in the host app initializer

The engine's authenticate_coplan_user! was returning a bare 401 Unauthorized
when the auth callback returned nil. For host apps with a login page (like
this dev host), users should be redirected to sign in instead.

- Add sign_in_path config option to CoPlan::Configuration
- Redirect to sign_in_path when set, fall back to head :unauthorized
- Configure /sign_in in the host app initializer

Amp-Thread-ID: https://ampcode.com/threads/T-019cb4db-952a-7559-9ee4-15fcdd27cb1b
Co-authored-by: Amp <amp@ampcode.com>
@HamptonMakes HamptonMakes merged commit 8f71c82 into main Mar 3, 2026
4 checks passed
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