Skip to content

Commit

Permalink
Add code snipet for seeing what's in the id token
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Aug 31, 2024
1 parent 2b00ed8 commit e193548
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
15 changes: 15 additions & 0 deletions examples/react-router/src/oidc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ export const {
* by querying a GET /user endpoint with a authorization header
* like `Bearer <accessToken>`.
*/
/*
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()
Expand Down
17 changes: 16 additions & 1 deletion examples/tanstack-router-file-based/src/oidc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ export const {
* by querying a GET /user endpoint with a authorization header
* like `Bearer <accessToken>`.
*/
/*
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()
Expand All @@ -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:
Expand Down
15 changes: 15 additions & 0 deletions examples/tanstack-router/src/oidc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ export const {
* by querying a GET /user endpoint with a authorization header
* like `Bearer <accessToken>`.
*/
/*
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()
Expand Down

0 comments on commit e193548

Please sign in to comment.