-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Hack4Impact-UMD/swaliga-fou…
- Loading branch information
Showing
13 changed files
with
190 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { NextRequest, NextResponse } from "next/server"; | ||
import { adminAuth } from "@/lib/firebase/firebaseAdminConfig"; | ||
|
||
// sets the role user claim to "STUDENT" for new account with the given uid | ||
export async function POST(req: NextRequest): Promise<NextResponse> { | ||
const body = await req.json(); | ||
try { | ||
await adminAuth.setCustomUserClaims(body.uid, { role: "ADMIN" }); | ||
return NextResponse.json({ success: true }, { status: 200 }); | ||
} catch (err) { | ||
console.error(err); | ||
return NextResponse.json({ error: err }, { status: 500 }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { authorizeWithGoogle } from "@/lib/googleAuthorization"; | ||
|
||
export function GET() { | ||
authorizeWithGoogle(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { NextRequest, NextResponse } from "next/server"; | ||
import { redirect } from "next/navigation"; | ||
import { setCredentialsWithAuthCode } from "@/lib/googleAuthorization"; | ||
|
||
export async function GET(req: NextRequest) { | ||
const query = req.nextUrl.searchParams; | ||
if (query.get("code")) { | ||
console.log(query.get("code")); | ||
const credsSet = await setCredentialsWithAuthCode(query.get("code") as string); | ||
if (credsSet) { | ||
return NextResponse.redirect("http://localhost:3000"); | ||
} | ||
redirect("/"); | ||
} | ||
console.error(query.get("error")); | ||
redirect("/"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { NextRequest, NextResponse } from "next/server"; | ||
import { updateRefreshToken } from "@/lib/googleAuthorization"; | ||
|
||
// refreshs the admin account's refresh token if it does not exist or has expired | ||
export async function POST(req: NextRequest): Promise<NextResponse> { | ||
try { | ||
await updateRefreshToken(); | ||
return NextResponse.json({ success: true }, { status: 200 }); | ||
} catch (err) { | ||
console.error(err); | ||
return NextResponse.json({ error: err }, { status: 500 }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters