MCPcopy Create free account
hub / github.com/KartikLabhshetwar/foliox / getUserGitHubToken

Function getUserGitHubToken

lib/utils/github-token.ts:4–24  ·  view source on GitHub ↗
(userId?: string)

Source from the content-addressed store, hash-verified

2import { prisma } from "@/lib/utils/db";
3
4export async function getUserGitHubToken(userId?: string): Promise<string | null> {
5 if (!userId) {
6 return null;
7 }
8
9 try {
10 const account = await prisma.account.findFirst({
11 where: {
12 userId,
13 providerId: "github",
14 },
15 select: {
16 accessToken: true,
17 },
18 });
19
20 return account?.accessToken || null;
21 } catch {
22 return null;
23 }
24}
25
26export async function getSessionUserToken(request?: Request): Promise<string | null> {
27 try {

Callers 2

getUserGitHubUsernameFunction · 0.90
getSessionUserTokenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected