Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Co-authored-by: Omar López <zomars@me.com> Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com>
13 lines
334 B
TypeScript
13 lines
334 B
TypeScript
import type { NextApiRequest } from "next";
|
|
|
|
import type { IntegrationOAuthCallbackState } from "../../types";
|
|
|
|
export function decodeOAuthState(req: NextApiRequest) {
|
|
if (typeof req.query.state !== "string") {
|
|
return undefined;
|
|
}
|
|
const state: IntegrationOAuthCallbackState = JSON.parse(req.query.state);
|
|
|
|
return state;
|
|
}
|