Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9b4918f
feat(public): add Auth.js infra alongside bento-auth-js
SanjeevLakhwani Sep 8, 2026
9382bc1
feat(public): switch every bento-auth-js consumer over to Auth.js
SanjeevLakhwani Sep 8, 2026
de57388
chore(public): drop bento-auth-js dependency
SanjeevLakhwani Sep 8, 2026
5b5c064
fix(public): set explicit OIDC issuer for Auth.js provider config
SanjeevLakhwani Sep 8, 2026
2bb7cfc
refactor(public): extract session refetch interval into a named constant
SanjeevLakhwani Sep 8, 2026
64a1ac0
refactor(public): reuse bento-auth-js's resource/permission exports i…
SanjeevLakhwani Sep 8, 2026
87fd4b1
refactor(public): remove redundant comments from Auth.js migration
SanjeevLakhwani Sep 9, 2026
9b1a3c9
Merge branch 'feat/next-migration-step1' into feat/authjs-migration
SanjeevLakhwani Sep 9, 2026
9c2cdba
fix(public): force re-auth when refresh token becomes invalid
SanjeevLakhwani Sep 11, 2026
b459d2c
fix(public): wait for the Auth.js session before fetching projects
SanjeevLakhwani Sep 23, 2026
d12f77e
refactor(public): make the session refetch interval an env var
SanjeevLakhwani Sep 23, 2026
1ad5662
refactor(public): share the OIDC provider id between Auth.js config a…
SanjeevLakhwani Sep 23, 2026
abbcc48
Merge remote-tracking branch 'origin/main' into feat/authjs-migration
SanjeevLakhwani Sep 23, 2026
6017815
Merge remote-tracking branch 'origin/main' into feat/authjs-migration
SanjeevLakhwani Sep 25, 2026
2412a42
refactor(public): rename bentoProvider to bentoOidcProvider for clarity
SanjeevLakhwani Sep 30, 2026
f495d4a
docs(public): note the discovery document cache duration
SanjeevLakhwani Sep 30, 2026
37d439b
docs(public): credit bento-auth-js for the ported permission hooks
SanjeevLakhwani Sep 30, 2026
bae0159
docs(public): combine session/JWT module augmentation comments
SanjeevLakhwani Sep 30, 2026
e347af5
Merge remote-tracking branch 'origin/main' into feat/authjs-migration
SanjeevLakhwani Sep 30, 2026
a562795
fix(public): use our own useAccessToken in TracksView, not bento-auth…
SanjeevLakhwani Sep 30, 2026
232a7dc
Merge remote-tracking branch 'origin/main' into feat/authjs-migration
SanjeevLakhwani Oct 1, 2026
5b97827
fix(public): keep Sign Out button in a loading state through the redi…
SanjeevLakhwani Oct 1, 2026
4190f9a
docs(public): explain jwt/session callbacks and add safety note + TODO
SanjeevLakhwani Oct 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"i18next-http-backend": "^4.0.1",
"leaflet": "^1.9.4",
"next": "^16.3.1",
"next-auth": "^5.0.0-beta.32",
Comment thread
davidlougheed marked this conversation as resolved.
"react": "^19.2.8",
"react-dom": "^19.2.8",
"react-error-boundary": "^6.1.2",
Expand Down
3 changes: 3 additions & 0 deletions src/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { handlers } from '@/auth';

export const { GET, POST } = handlers;
11 changes: 11 additions & 0 deletions src/app/api/auth/end-session-url/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { CLIENT_ID, getEndSessionEndpoint } from '@/auth';

export async function GET() {
try {
const endSessionEndpoint = await getEndSessionEndpoint();
return Response.json({ endSessionEndpoint: endSessionEndpoint ?? null, clientId: CLIENT_ID });
} catch (err) {
console.error('Error discovering end_session_endpoint', err);
return Response.json({ endSessionEndpoint: null, clientId: CLIENT_ID });
}
}
3 changes: 1 addition & 2 deletions src/app/public/config.js/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ export function GET() {
BEACON_NETWORK_ENABLED: parseBoolean(process.env.BENTO_BEACON_NETWORK_ENABLED),

// Authentication
CLIENT_ID: process.env.CLIENT_ID || null,
OPENID_CONFIG_URL: process.env.OPENID_CONFIG_URL || null,
SESSION_REFETCH_INTERVAL_SECONDS: process.env.BENTO_PUBLIC_SESSION_REFETCH_INTERVAL_SECONDS || '120',
};

return new Response(`BENTO_PUBLIC_CONFIG = ${JSON.stringify(siteConfig, null, 2)};\n`, {
Expand Down
34 changes: 13 additions & 21 deletions src/js/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useEffect } from 'react';
// Redux and routing imports
import { Provider } from 'react-redux';
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
import { SessionProvider } from 'next-auth/react';

// i18n and constants imports
import { useTranslation } from 'react-i18next';
Expand All @@ -19,20 +20,19 @@ import frCA from 'antd/locale/fr_CA';
import dayjs from 'dayjs';
import 'dayjs/locale/fr-ca';
import { ChartConfigProvider } from 'bento-charts';
import Loader from '@/components/Loader';
import BentoAppRouter from '@/components/BentoAppRouter';
import LanguageHandler from '@/components/Util/LanguageHandler';
import AuthOutlet from '@/components/Util/AuthOutlet';
import ResponsiveProvider from '@/components/Util/ResponsiveProvider';

// Hooks and utilities imports
import { BentoAuthContext } from 'bento-auth-js';
import { NotificationProvider } from '@/hooks/notifications';
import { useSmallScreen } from '@/hooks/useResponsiveContext';
import { useHandleRefreshTokenError } from '@/features/auth/hooks';

// Store and configuration imports
import { store } from './store';
import { AUTH_CALLBACK_URL, CLIENT_ID, OPENID_CONFIG_URL, PCGL_MODE, PUBLIC_URL_NO_TRAILING_SLASH } from './config';
import { PCGL_MODE, SESSION_REFETCH_INTERVAL_SECONDS } from './config';

// Styles imports
import 'antd/dist/reset.css';
Expand All @@ -47,7 +47,6 @@ const BaseRoutes = () => {
return (
<Routes>
<Route element={<AuthOutlet />}>
<Route path="/callback" element={<Loader fullHeight={true} />} />
<Route element={<LanguageHandler />}>
<Route path="/:lang/*" element={<BentoAppRouter />} />
<Route path="*" element={<Navigate to="/en/" />} />
Expand All @@ -63,6 +62,8 @@ const InnerRootApp = () => {
const antdLocale = i18n.language === SUPPORTED_LNGS.FRENCH ? frCA : enUS;
const isSmallScreen = useSmallScreen();

useHandleRefreshTokenError();

// antd's ConfigProvider locale only translates UI text (buttons, placeholders); the DatePicker's
// month/day names come from dayjs's own locale, which must be set separately or it stays English.
useEffect(() => {
Expand Down Expand Up @@ -93,24 +94,15 @@ const InnerRootApp = () => {
};

const RootApp = () => (
<Provider store={store}>
<BrowserRouter>
<ResponsiveProvider>
<BentoAuthContext
value={{
applicationUrl: PUBLIC_URL_NO_TRAILING_SLASH,
openIdConfigUrl: OPENID_CONFIG_URL,
clientId: CLIENT_ID,
scope: 'openid email',
postSignOutUrl: `${PUBLIC_URL_NO_TRAILING_SLASH}/`,
authCallbackUrl: AUTH_CALLBACK_URL,
}}
>
<SessionProvider refetchInterval={SESSION_REFETCH_INTERVAL_SECONDS}>
<Provider store={store}>
<BrowserRouter>
<ResponsiveProvider>
<InnerRootApp />
</BentoAuthContext>
</ResponsiveProvider>
</BrowserRouter>
</Provider>
</ResponsiveProvider>
</BrowserRouter>
</Provider>
</SessionProvider>
);

export default RootApp;
Loading
Loading