From aef37ed00b7438bd679598a79039a897ba642b1b Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Thu, 23 Nov 2023 03:56:44 +0100 Subject: [PATCH 1/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c8c43a9..d40e0e7 100644 --- a/README.md +++ b/README.md @@ -85,8 +85,8 @@ import { createOidc, decodeJwt } from "oidc-spa"; }); if (!oidc.isUserLoggedIn) { + // This return a promise that never resolve. Your user will be redirected to the identity server. oidc.login({ - // This return a promise that never resolve. Your user will be redirected to the identity server. // doesCurrentHrefRequiresAuth determines the behavior when a user gives up on loggin in and navigate back. // We don't want to send him back to a authenticated route. // If you are calling login because the user clicked From e4cc20a65b07a8596458f2e26466986f443b36b1 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Thu, 23 Nov 2023 03:59:27 +0100 Subject: [PATCH 2/3] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d40e0e7..44dcf00 100644 --- a/README.md +++ b/README.md @@ -105,11 +105,11 @@ import { createOidc, decodeJwt } from "oidc-spa"; idToken } = oidc.getTokens(); - const user = decodeJwt<{ + const user = decodeJwt(idToken) as { // Use https://jwt.io/ to tell what's in your idToken sub: string; preferred_username: string; - }>(idToken); + }; console.log(`Hello ${user.preferred_username}`); From 6483d8f764f703d950086d16b4672f5272aea1d8 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Thu, 23 Nov 2023 04:01:13 +0100 Subject: [PATCH 3/3] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 44dcf00..0ee50b9 100644 --- a/README.md +++ b/README.md @@ -198,11 +198,11 @@ function useUser() { const user = useMemo( () => - decodeJwt<{ + decodeJwt(idToken) as { // Use https://jwt.io/ to tell what's in your idToken sub: string; preferred_username: string; - }>(idToken), + }, [idToken] );