Skip to content

Commit 32770ac

Browse files
committed
bug find
1 parent 9034cd9 commit 32770ac

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

main.jac

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,9 @@ def:priv mint_session_token(login: str) -> str {
913913
if not user_id {
914914
return "";
915915
}
916-
return str(um.create_jwt_token(user_id));
916+
# include_role=False: skip the extra user-store role lookup — this app gates
917+
# on live GitHub repo permission (has_write_access), not jac-scale roles.
918+
return str(um.create_jwt_token(user_id, include_role=False));
917919
}
918920

919921

@@ -1544,9 +1546,16 @@ walker:pub GithubOAuthExchange {
15441546
return;
15451547
}
15461548
gh_token = str(profile["token"]);
1547-
token = mint_session_token(str(profile["login"]));
1549+
try {
1550+
token = mint_session_token(str(profile["login"]));
1551+
} except Exception as e {
1552+
# Surface the real cause (jac-scale user store / Mongo / JWT) to the
1553+
# client instead of a generic failure, so prod issues are diagnosable.
1554+
report {"ok": False, "error": f"session error: {e}"};
1555+
return;
1556+
}
15481557
if not token {
1549-
report {"ok": False, "error": "could not start session"};
1558+
report {"ok": False, "error": "could not start session (no user id)"};
15501559
return;
15511560
}
15521561
# token: jac-scale session JWT (the browser stores it as `jac_token`, the

0 commit comments

Comments
 (0)