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
import { AnyZodObject, z } from 'zod' | |
import { Metadata, ResolvingMetadata } from 'next' | |
type InferParams<Params> = Params extends readonly string[] | |
? { | |
[K in Params[number]]: string | |
} | |
: Params extends AnyZodObject | |
? z.infer<Params> | |
: unknown |
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
import type { NextApiHandler, NextApiRequest, NextApiResponse } from 'next' | |
import jwt from 'jsonwebtoken'; | |
import {v4 as uuidv4} from 'uuid'; | |
import concatHeader from '../utils/concat-cookie' | |
import getConfig from '../utils/get-config' | |
function getSsoLoginUrl(customerId: number, storeHash: string, storeUrl: string, clientId: string, clientSecret: string) { | |
const dateCreated = Math.round((new Date()). getTime() / 1000); | |
const payload = { | |
"iss": clientId, |