From e193548f71ef525c2f6fc5bb2550df7c34beeeb5 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Sat, 31 Aug 2024 04:48:24 +0200 Subject: [PATCH] Add code snipet for seeing what's in the id token --- examples/react-router/src/oidc.tsx | 15 +++++++++++++++ .../tanstack-router-file-based/src/oidc.tsx | 17 ++++++++++++++++- examples/tanstack-router/src/oidc.tsx | 15 +++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/examples/react-router/src/oidc.tsx b/examples/react-router/src/oidc.tsx index 81f3a17..53d3971 100644 --- a/examples/react-router/src/oidc.tsx +++ b/examples/react-router/src/oidc.tsx @@ -56,6 +56,21 @@ export const { * by querying a GET /user endpoint with a authorization header * like `Bearer `. */ + /* + decodedIdTokenSchema: { + parse: (decodedIdToken) => { + + type DecodedIdToken = { + sub: string; + preferred_username: string + }; + + console.log(decodedIdToken); + + return decodedIdToken as DecodedIdToken; + } + }, + */ decodedIdTokenSchema: z.object({ sub: z.string(), preferred_username: z.string() diff --git a/examples/tanstack-router-file-based/src/oidc.tsx b/examples/tanstack-router-file-based/src/oidc.tsx index 81f3a17..f4703d9 100644 --- a/examples/tanstack-router-file-based/src/oidc.tsx +++ b/examples/tanstack-router-file-based/src/oidc.tsx @@ -56,6 +56,21 @@ export const { * by querying a GET /user endpoint with a authorization header * like `Bearer `. */ + /* + decodedIdTokenSchema: { + parse: (decodedIdToken) => { + + type DecodedIdToken = { + sub: string; + preferred_username: string + }; + + console.log(decodedIdToken); + + return decodedIdToken as DecodedIdToken; + } + }, + */ decodedIdTokenSchema: z.object({ sub: z.string(), preferred_username: z.string() @@ -70,7 +85,7 @@ export const { ui_locales: "en" // Gere you would dynamically get the current language at the time of redirecting to the OIDC server }), // Remove this in your repo - doEnableDebugLogs: true + doEnableDebugLogs: false }); // Using the mock adapter: diff --git a/examples/tanstack-router/src/oidc.tsx b/examples/tanstack-router/src/oidc.tsx index 81f3a17..53d3971 100644 --- a/examples/tanstack-router/src/oidc.tsx +++ b/examples/tanstack-router/src/oidc.tsx @@ -56,6 +56,21 @@ export const { * by querying a GET /user endpoint with a authorization header * like `Bearer `. */ + /* + decodedIdTokenSchema: { + parse: (decodedIdToken) => { + + type DecodedIdToken = { + sub: string; + preferred_username: string + }; + + console.log(decodedIdToken); + + return decodedIdToken as DecodedIdToken; + } + }, + */ decodedIdTokenSchema: z.object({ sub: z.string(), preferred_username: z.string()