Repository navigation
Description
Overview
After a successful GitHub OAuth round-trip, CallbackClient sends every single user to the same place, unconditionally:
useEffect(() => {
const token = searchParams.get("token");
if (!token) {
setError("No token was returned by GitHub sign-in.");
return;
}
login(token)
.then(() => router.replace("/dashboard/contributor"))
.catch(() => setError("Could not complete sign-in. Please try again."));
}, [searchParams, login, router]);login(token) calls AuthContext.login → refresh(), which fetches the full profile via /auth/me then /users/${session.userId} — resolving to an AuthUser that already carries roles: UserRole[] ("contributor" | "maintainer" | "sponsor", src/types/index.ts:1,82-89). That field is fetched from the backend on every single auth resolution, and then never read: I grepped the entire src/ tree for .roles and got zero matches outside the type declaration itself. Nothing in this frontend — not CallbackClient, not Navbar, not DashboardShell — ever branches on user.roles.
The concrete, visible consequence here: a maintainer or sponsor who signs in with GitHub for the very first time is redirected to /dashboard/contributor regardless of what roles the backend just told this app they have. If they only have roles: ["sponsor"] (say, an organization's funding lead who has never contributed code and never will), they land on a page built entirely around personal claims/earnings/PR stats that don't apply to them at all, and have to manually discover the "Dashboards" nav dropdown to find the page that actually matches who they are.
This is a real, verifiable, main-branch-current gap distinct from #48 ("Fix Navbar loading-state flashes and multi-role rendering logic"), which is scoped to Navbar.tsx's own loading/rendering behavior — this issue is about the OAuth post-login redirect target in an entirely different file (CallbackClient.tsx), and about the broader fact that the roles field the backend already sends is completely inert throughout the app, not about any specific navbar rendering bug.
Requirements
- Change
CallbackClient's post-login redirect to consideruser.roles(available afterlogin(token)resolves, viauseAuth()'suser) rather than hardcoding/dashboard/contributor. Define a sane precedence when a user has multiple roles (e.g. prefer maintainer > sponsor > contributor, or whichever ordering the product actually wants — this is a real decision, not a mechanical one, and should be stated explicitly in the PR). - Handle the case of a user with an empty
rolesarray (a brand-new GitHub sign-in with no role assigned yet, if that's a state the backend can produce) — falling back to/dashboard/contributoras a sane default for that specific case is reasonable, but should be an explicit, intentional branch, not the unconditional behavior for every user. - This issue is intentionally scoped to
CallbackClient.tsx's redirect decision. Do not also rewriteNavbar.tsx's orDashboardShell.tsx's role-based rendering as part of this fix — that territory is already covered by Fix Navbar loading-state flashes and multi-role rendering logic #48; note in the PR thatuser.rolesis currently unused anywhere in the app (this issue's own grep finding) so whoever picks up Fix Navbar loading-state flashes and multi-role rendering logic #48 has that context, but keep this PR's diff scoped to the redirect target alone.
Acceptance Criteria
- A user whose
rolesincludes"maintainer"(and not"contributor") is redirected to/dashboard/maintainerafter completing GitHub OAuth, not/dashboard/contributor. - A user whose
rolesincludes"sponsor"(and not"contributor"or"maintainer") is redirected to/dashboard/sponsor. - A user with multiple roles is redirected per an explicit, documented precedence order.
- A user with an empty/absent
rolesarray still lands somewhere sensible (no broken redirect, no infinite loop, no crash) — document which fallback was chosen and why. - A test covers each of the above redirect-target cases by mocking
useAuth()'slogin/userand assertingrouter.replaceis called with the expected path.
Additional Notes
Precise references:
src/app/auth/callback/CallbackClient.tsx:13-23— the full effect,router.replace("/dashboard/contributor")hardcoded at line 21 regardless of the resolved user.src/types/index.ts:1(export type UserRole = "contributor" | "maintainer" | "sponsor";) and:82-89(AuthUser.roles: UserRole[]).src/context/AuthContext.tsx:56-62—login(token):persistToken(token); await refresh();— confirmsuseris populated (viarefresh()'ssetUser(profile)) by the timelogin()'s returned promise resolves, soCallbackClientcan read the resolved role list immediately afterawait login(token)without an extra round-trip.- Grep evidence:
grep -rn "\.roles" src/(run againstmain@9c8f4b3) returns zero matches anywhere in application code — confirmingrolesis fetched by every single auth resolution and never consulted by anything today, which is the underlying condition that makes this specific redirect bug possible and worth flagging explicitly rather than assuming it's a one-off oversight.
Edge cases: router.replace runs inside a .then() after login(token) — if login resolves but the subsequent /users/${session.userId} fetch inside refresh() itself fails (caught internally by AuthContext.refresh's own try/catch, which calls clearToken(); setUser(null) on failure — see AuthContext.tsx:35-46), then user would be null at the moment CallbackClient tries to read user.roles for the redirect decision, even though login(token)'s promise itself resolved successfully (refresh() doesn't rethrow on its own internal catch). Handle this explicitly — don't assume user is non-null just because login() didn't throw.
Test/reproduction plan: render CallbackClient with a token search param present, mock useAuth() to return a login that resolves and a user with roles: ["maintainer"], and assert router.replace is called with /dashboard/maintainer. Repeat for ["sponsor"], ["maintainer", "sponsor"] (precedence check), and []/undefined (fallback check).
Activity
Muzzy-Cyber commentedon Aug 25, 2026
@Muzzy-Cyber has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Muzzy-Cyber to this issue.
Songu3020 commentedon Aug 25, 2026
@Songu3020 has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Songu3020 to this issue.
ridwanraji1290-ai commentedon Aug 25, 2026
@ridwanraji1290-ai has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @ridwanraji1290-ai to this issue.
Ukorstack commentedon Aug 25, 2026
@Ukorstack has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Ukorstack to this issue.
brightcli-stack commentedon Aug 25, 2026
@brightcli-stack has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @brightcli-stack to this issue.
p4uld4vid016-code commentedon Aug 25, 2026
@p4uld4vid016-code has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @p4uld4vid016-code to this issue.
Leemxiey commentedon Aug 25, 2026
@Leemxiey has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Leemxiey to this issue.
Muyideen-js commentedon Aug 25, 2026
@Muyideen-js has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Muyideen-js to this issue.
Promzy204-bad commentedon Aug 25, 2026
@Promzy204-bad has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Promzy204-bad to this issue.
drips-wave commentedon Aug 25, 2026
Congratulations, @brightcli-stack! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.
🧑💻 @brightcli-stack: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
Warning
When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
fix: validate deposits, fix milestone progress, XLM precision, role-b…
drips-wave commentedon Aug 25, 2026
This issue has been completed by @brightcli-stack as part of the Stellar Wave Program's 8th Wave 🥳
😎 @brightcli-stack: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.