Generic coach signup + JWT auth fix #30
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/basketball-api#30
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lineage
plan-2026-03-08-tryout-prep→ Phase 3a-iii (Demo prep)Repo
forgejo_admin/basketball-apiUser Story
As Marcus (program director)
I want ONE coach signup link I can text to all coaches
So that coaches can self-register without me creating individual invites
As an admin
I want JWT auth to work on admin endpoints
So that I can call
/admin/generate-tokensand/admin/invite-coachContext
Coach signup: Current system requires admin to call
POST /admin/invite-coachto pre-create each coach with an individual token. Marcus wants a single generic link (/coach/signup) — no token, no admin pre-creation. Coach fills in name/email/phone, signs the same contractor agreement, proceeds to Stripe Connect. Same flow, just open access.JWT fix: Admin endpoints return "Invalid or expired token". Root cause:
_build_auth_config()inmain.pydoesn't settoken_issuer. Thepal_e_authlibrary defaultstoken_issuerto"pal-e-auth"inAuthConfig(see~/pal-e-auth/src/pal_e_auth/config.py:15).decode_token()validatesissclaim matchesconfig.token_issuer. Need to explicitly set it so tokens from Google OAuth flow validate correctly.File Targets
Files to modify:
src/basketball_api/routes/coach.py— addGET /signupandPOST /signuproutes (open access, no token). Reuse existing_render_agreement_pageHTML helper but without pre-filled coach data. Create Coach record on POST, sign agreement, redirect to Stripe Connect.src/basketball_api/main.py— addtoken_issuer="pal-e-auth"to_build_auth_config()AuthConfig constructor (line 28-34)tests/test_coach_signup.py— new test file for generic signup flowFiles NOT to touch:
src/basketball_api/routes/admin.py— existing admin endpoints are fine, just need JWT fixsrc/basketball_api/services/coach_onboarding.py— existing service functions work for both flowsAcceptance Criteria
GET /coach/signuprenders branded contractor agreement form with empty fields (no token required)POST /coach/signupcreates a Coach record withtenant_id=1, signs agreement, records timestamp + IP/coach/onboard?token=xxxflow still works unchangedTest Expectations
GET /coach/signupreturns 200 with agreement HTMLPOST /coach/signupwith valid form data creates Coach record, returns redirectPOST /coach/signupwithout agreeing returns 400pytest tests/ -vConstraints
_AGREEMENT_TEXTand_STYLEfrom coach.py — same look and feeltenant_id=1(Westside) — single tenant for now/coach/signuproutes should NOT require any authenticationChecklist
Related
project-westside-basketball