chore: migrate oauth APIs to app router (#19824)
* migrate api/auth/oauth/me * migrate the rest * fix --------- Co-authored-by: Anik Dhabal Babu <[email protected]>
This commit is contained in:
1 parent
4a4bee7140
commit
3ab053bf17
6 files changed
+40
-53
No files matched your search
@@ -1,11 +1,9 @@
|
||||
import jwt from "jsonwebtoken";
|
||||
import type { NextApiRequest } from "next";
|
||||
|
||||
import prisma from "@calcom/prisma";
|
||||
import type { OAuthTokenPayload } from "@calcom/types/oauth";
|
||||
|
||||
export default async function isAuthorized(req: NextApiRequest, requiredScopes: string[] = []) {
|
||||
const token = req.headers.authorization?.split(" ")[1] || "";
|
||||
export default async function isAuthorized(token: string, requiredScopes: string[] = []) {
|
||||
let decodedToken: OAuthTokenPayload;
|
||||
try {
|
||||
decodedToken = jwt.verify(token, process.env.CALENDSO_ENCRYPTION_KEY || "") as OAuthTokenPayload;
|
||||
|
||||
Reference in new issue
Block a user