Fix onboarding OAuth callback glitch (#1079)
This commit is contained in:
1 parent
d147772d91
commit
a002b194da
7 files changed
+66
-33
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { NextApiRequest } from "next";
|
||||
|
||||
import { IntegrationOAuthCallbackState } from "./types";
|
||||
|
||||
export function encodeOAuthState(req: NextApiRequest) {
|
||||
if (typeof req.query.state !== "string") {
|
||||
return undefined;
|
||||
}
|
||||
const state: IntegrationOAuthCallbackState = JSON.parse(req.query.state);
|
||||
|
||||
return JSON.stringify(state);
|
||||
}
|
||||
|
||||
export function decodeOAuthState(req: NextApiRequest) {
|
||||
if (typeof req.query.state !== "string") {
|
||||
return undefined;
|
||||
}
|
||||
const state: IntegrationOAuthCallbackState = JSON.parse(req.query.state);
|
||||
|
||||
return state;
|
||||
}
|
||||
Reference in new issue
Block a user