Skip to content
Snippets Groups Projects
Verified Commit 6417118a authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: OAuth authn

parent fbd489cf
Branches
No related tags found
No related merge requests found
Pipeline #48727 passed
...@@ -208,7 +208,7 @@ function MyApp ({ ...@@ -208,7 +208,7 @@ function MyApp ({
return ( return (
<SessionProvider session={session} <SessionProvider session={session}
refetchInterval={3 * 60} refetchInterval={10}
refetchOnWindowFocus={true} refetchOnWindowFocus={true}
> >
<App>{renderComponent()}</App> <App>{renderComponent()}</App>
......
...@@ -93,6 +93,7 @@ export const authOptions = { ...@@ -93,6 +93,7 @@ export const authOptions = {
// Initial sign in // Initial sign in
if (account && user) { if (account && user) {
return { return {
lastRefresh: Date.now(),
accessToken: account.access_token, accessToken: account.access_token,
accessTokenExpires: account.expires_at, accessTokenExpires: account.expires_at,
refreshToken: account.refresh_token, refreshToken: account.refresh_token,
...@@ -100,8 +101,8 @@ export const authOptions = { ...@@ -100,8 +101,8 @@ export const authOptions = {
} }
} }
// Return previous token if the access token will still not be expired in 60 seconds. if (token.lastRefresh + 10000 > Date.now()) {
if (Date.now() + 60000 < token.accessTokenExpires) { // return if last refresh is 10 seconds or younger
return token return token
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment