Skip to content
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
93aac8d
deps: install `kinde-auth-react`, bump `js-utils`
Yoshify Oct 2, 2025
b603a45
chore: allow usage of `NEXT_PUBLIC_` for issuer URL, Site URL, and Cl…
Yoshify Oct 2, 2025
4db0244
chore: introduce dedicated utils file, move `fetchKindeState` there a…
Yoshify Oct 2, 2025
192709f
chore: introduce dedicated frontend types file
Yoshify Oct 2, 2025
8f9f76c
feat: introduce dedicated hook for fetching and managing state retrie…
Yoshify Oct 2, 2025
817ae01
feat: introduce KindeProvider from React, populate client store with …
Yoshify Oct 2, 2025
6a12a2c
tests: baseline test for `useKindeBrowserClient` pre-refactor
Yoshify Oct 2, 2025
2fdf87e
chore: move to `/hooks/internal`
Yoshify Oct 2, 2025
97a8412
chore: rename type
Yoshify Oct 2, 2025
b14e47c
feat: introduce `js-utils` store for frontend
Yoshify Oct 2, 2025
27a4be5
chore: move default client state to dedicated constants file
Yoshify Oct 2, 2025
795b8bc
feat: Introduce new `KindeProvider`, move old one
Yoshify Oct 2, 2025
cb7db00
chore: introduce re-usable factories for implementing client-side fun…
Yoshify Oct 2, 2025
c2b3518
chore: update naming, introduce refetch
Yoshify Oct 2, 2025
988eed2
feat: introduce new provider and providerless hooks
Yoshify Oct 2, 2025
a5c4954
feat: `useKindeBrowserClient` now routes to provided or providerless …
Yoshify Oct 2, 2025
4a24761
chore: update exports
Yoshify Oct 2, 2025
ea50df4
chore: format pass
Yoshify Oct 2, 2025
0e8eeeb
chore: remove queueing from setup route
Yoshify Oct 2, 2025
74b3e54
chore: remove unnecessary state call
Yoshify Oct 2, 2025
5fa9bf4
chore: fix broken types for feature flags
Yoshify Oct 2, 2025
9fc866d
chore: add strict return type signature
Yoshify Oct 2, 2025
988771c
chore: add public env passthrough in `/setup`
Yoshify Oct 2, 2025
79f8c78
chore: use public env provided from `/setup`
Yoshify Oct 2, 2025
6690f3e
chore: don't set env in `useFetchedKindeState`
Yoshify Oct 2, 2025
fff0e8b
chore: lint pass
Yoshify Oct 2, 2025
c6c3c18
feat: allow users to provide a loading state fallback in the provider
Yoshify Oct 2, 2025
9041599
fix: guard against potentially missing tokens
Yoshify Oct 2, 2025
81b6e27
fix: wrap `setupState` in `useCallback`
Yoshify Oct 2, 2025
22666c8
fix: fallback for null configs
Yoshify Oct 2, 2025
f47d291
fix: wrap `transformState` in `useCallback`
Yoshify Oct 2, 2025
2311b70
fix: remove `onSuccess` from `setupState` dep array as the reference …
Yoshify Oct 2, 2025
147fa4d
fix: gracefully handle fetch/parse failures
Yoshify Oct 2, 2025
90c7fb9
fix: ensure `useFetchedKindeState` destroys client-side sessions
Yoshify Oct 2, 2025
325bcb2
chore: lint
Yoshify Oct 2, 2025
1285d78
chore: remove log
Yoshify Oct 2, 2025
3a5767b
refactor: `useSessionSync` for improved session management
Yoshify Oct 9, 2025
24e9ac8
refactor: simplify KindeProvider by integrating useSessionSync
Yoshify Oct 9, 2025
06b006f
refactor: `useSessionSync` instead of `useFetchedKindeState`
Yoshify Oct 9, 2025
b270cd9
refactor: enhance fetchKindeState to include PublicKindeConfig in all…
Yoshify Oct 9, 2025
e24a6ce
feat: include environment details in error responses to allow KindePr…
Yoshify Oct 9, 2025
ae8d69e
refactor: add optional chaining to improve safety in transformReactAu…
Yoshify Oct 9, 2025
b3b44f5
chore: lint
Yoshify Oct 9, 2025
45133ab
chore: bump deps
Yoshify Oct 9, 2025
f922c2a
chore: fix lock file
Yoshify Oct 9, 2025
49583f7
refactor: improve error handling in fetchKindeState
Yoshify Oct 9, 2025
89c6a54
chore: lockfile maintainance
DanielRivers Oct 9, 2025
a2203e3
chore: remove baseline test file
Yoshify Oct 9, 2025
345e770
Merge branch 'feat/client-react' of https://github.com/kinde-oss/kind…
Yoshify Oct 9, 2025
4afa3db
feat: implement refreshData in useProvidedKindeAuth hook
Yoshify Oct 9, 2025
8ae9d5f
chore: remove `js-utils` as a dependency, use the utils export from r…
Yoshify Oct 13, 2025
d076030
feat: add session expiry calculation and refresh handler
Yoshify Oct 13, 2025
89f30d4
feat: integrate refresh handler
Yoshify Oct 13, 2025
90fdf85
fix: use `isTokenExpired` from js-utils instead of our own to account…
Yoshify Oct 13, 2025
92b478b
chore: lint
Yoshify Oct 13, 2025
7a0aaae
feat: rewrite `isTokenExpired` to add threshold
Yoshify Oct 13, 2025
72caad8
chore: fix lockfile
Yoshify Oct 13, 2025
5c56ab7
fix: change error handling in `isTokenExpired` to return true on error
Yoshify Oct 13, 2025
6581e2d
fix: ensure all failure paths in `setup` still return env
Yoshify Oct 13, 2025
3b764fe
fix: remove header copying in middleware to avoid overwtiting `Set-Co…
Yoshify Oct 15, 2025
1c1a70a
fix: copy user returned response headers to the request
Yoshify Oct 15, 2025
8712e4b
fix: disable auto-refresh in providerless clients to prevent race con…
Yoshify Oct 15, 2025
1baf7a4
fix: use config for postLoginRedirectURL when not passed into endpoint
DanielRivers Oct 20, 2025
add4467
chore: PR review updates
DanielRivers Oct 22, 2025
e04a1e0
refactor: Change structure for dependancy array
DanielRivers Oct 22, 2025
7b1b9f1
fix: add expiry null protection
DanielRivers Oct 22, 2025
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@
"react-dom": "^18 || ^19"
},
"dependencies": {
"@kinde-oss/kinde-auth-react": "^5.8.0",
"@kinde-oss/kinde-typescript-sdk": "2.13.1",
"@kinde/js-utils": "^0.24.0",
"@kinde/jwt-decoder": "^0.2.0",
"@kinde/jwt-validator": "^0.4.0",
"cookie": "^1.0.2",
Expand Down
2,275 changes: 1,066 additions & 1,209 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/authMiddleware/authMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ const handleMiddleware = async (req, options, onSuccess) => {
const resp = NextResponse.next();

// if accessToken is expired, refresh it
if (isTokenExpired(kindeAccessToken) || isTokenExpired(kindeIdToken)) {
if (
isTokenExpired(kindeAccessToken, 20) ||
isTokenExpired(kindeIdToken, 20)
) {
if (config.isDebugMode) {
console.log("authMiddleware: access token expired, refreshing");
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/PortalLink.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { config, routes } from "../config/index";
import { GeneratePortalUrlParams } from "@kinde/js-utils";
import { GeneratePortalUrlParams } from "@kinde-oss/kinde-auth-react/utils";

export interface PortalLinkProps
extends React.AnchorHTMLAttributes<HTMLAnchorElement>,
Expand Down
11 changes: 8 additions & 3 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ const initialState = {

const SESSION_PREFIX = "pkce-verifier";

const KINDE_SITE_URL = removeTrailingSlash(process.env.KINDE_SITE_URL);
const KINDE_SITE_URL = removeTrailingSlash(
process.env.KINDE_SITE_URL || process.env.NEXT_PUBLIC_KINDE_SITE_URL,
);

const KINDE_POST_LOGIN_ALLOWED_URL_REGEX =
process.env.KINDE_POST_LOGIN_ALLOWED_URL_REGEX;
Expand All @@ -49,8 +51,11 @@ const KINDE_POST_LOGOUT_REDIRECT_URL = removeTrailingSlash(
process.env.KINDE_POST_LOGOUT_REDIRECT_URL,
);

const KINDE_ISSUER_URL = removeTrailingSlash(process.env.KINDE_ISSUER_URL);
const KINDE_CLIENT_ID = process.env.KINDE_CLIENT_ID;
const KINDE_ISSUER_URL = removeTrailingSlash(
process.env.KINDE_ISSUER_URL || process.env.NEXT_PUBLIC_KINDE_ISSUER_URL,
);
const KINDE_CLIENT_ID =
process.env.KINDE_CLIENT_ID || process.env.NEXT_PUBLIC_KINDE_CLIENT_ID;
const KINDE_CLIENT_SECRET = process.env.KINDE_CLIENT_SECRET;
const KINDE_AUDIENCE = process.env.KINDE_AUDIENCE;
const KINDE_COOKIE_DOMAIN = removeTrailingSlash(
Expand Down
323 changes: 0 additions & 323 deletions src/frontend/KindeBrowserClient.ts

This file was deleted.

Loading