feat: support device authorization (#3811)

This commit is contained in:
Alex Yang
2025-08-21 14:59:31 -07:00
committed by GitHub
parent 2edb2d6816
commit 5ded0904d4
28 changed files with 3150 additions and 74 deletions

19
demo/nextjs/lib/shared.ts Normal file
View File

@@ -0,0 +1,19 @@
import { ReadonlyURLSearchParams } from "next/navigation";
const allowedCallbackSet: ReadonlySet<string> = new Set([
"/dashboard",
"/device",
]);
export const getCallbackURL = (
queryParams: ReadonlyURLSearchParams,
): string => {
const callbackUrl = queryParams.get("callbackUrl");
if (callbackUrl) {
if (allowedCallbackSet.has(callbackUrl)) {
return callbackUrl;
}
return "/dashboard";
}
return "/dashboard";
};