From 7e0ca4eec33e2f5689ee4aaa59aa1482cb5812bc Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Tue, 23 Mar 2021 00:26:00 +0100 Subject: [PATCH] feat: document method to set token cookie Signed-off-by: Erik Larsson --- contrib/docs/tutorials/authenticate-api-requests.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/docs/tutorials/authenticate-api-requests.md b/contrib/docs/tutorials/authenticate-api-requests.md index 897e2378e7..c0ab7f9ceb 100644 --- a/contrib/docs/tutorials/authenticate-api-requests.md +++ b/contrib/docs/tutorials/authenticate-api-requests.md @@ -128,7 +128,7 @@ function msUntilExpiry(token) { // Calls the specified url regularly using an auth token to set a token cookie // to authorize regular HTTP requests when loading techdocs -async function setAuthCookie(url, getIdToken) { +async function setTokenCookie(url, getIdToken) { const token = await getIdToken(); const response = await fetch(url, { mode: 'cors', @@ -141,7 +141,7 @@ async function setAuthCookie(url, getIdToken) { const ms = msUntilExpiry(token) - 4 * 60 * 1000; setTimeout( () => { - setAuthCookie(url, getIdToken); + setTokenCookie(url, getIdToken); }, ms > 0 ? ms : 10000, ); @@ -161,7 +161,7 @@ const app = createApp({ align="center" onResult={async result => { // When logged in, set a token cookie - setAuthCookie( + setTokenCookie( await discoveryApi.getBaseUrl('cookie'), result.getIdToken, );