kinde-oss / kinde-auth-nextjs Goto Github PK
View Code? Open in Web Editor NEWKinde NextJS SDK - authentication for server rendered apps
Home Page: https://kinde.com/docs/developer-tools/nextjs-sdk/
License: MIT License
Kinde NextJS SDK - authentication for server rendered apps
Home Page: https://kinde.com/docs/developer-tools/nextjs-sdk/
License: MIT License
A simple app with one protected page using middleware does not work
import { withAuth } from "@kinde-oss/kinde-auth-nextjs/middleware";
export default withAuth(async function middleware(req) {
console.log("look at me", req.kindeAuth);
});
export const config = {
matcher: ["/admin"],
};
however, when doing this, it works
import { withAuth } from "@kinde-oss/kinde-auth-nextjs/middleware";
export default function middleware(req) {
return withAuth(req);
}
export const config = {
matcher: ["/admin"],
};
I don't have any special setup in-place. Just a public page with a <Link>
to a protected page.
https://github.com/kinde-oss/kinde-auth-nextjs
2.2.4
macOS
14.4.1
No response
No response
No response
We're missing the ability to set public paths for the middleware to ignore.
According to next.js design, multiple middleware are meant to be chained/nested, however currently adding the Kinde middleware to a next.js project will trigger auth check on all paths whenever middleware runs (per matcher:
setting)
Because most projects have protected and public paths, we desperately need a way to set public paths for Kinde to ignore auth for - i.e. the req.kindeAuth
would be optional, but lack of cookie or invalid token must not cause a redirect to login page. matcher
is not the way to do it, because the project might have other chained middleware that DO want to run on those paths (in other words, matcher
disables/enables all middleware, while we need to prevent just Kinde redirect in certain paths).
Here's the hard-coded value: https://github.com/kinde-oss/kinde-auth-nextjs/blob/main/src/authMiddleware/authMiddleware.js#L39
Here's how clerk middleware exposes this in publicPaths
: https://clerk.com/docs/references/nextjs/auth-middleware#options
https://github.com/kinde-oss/kinde-auth-nextjs/
2.1.15
macOS
n/a
next.js 14.1.3
No response
No response
Hey team, running into this issue when using the included auth button components in a client component: Module not found: Can't resolve 'fs'
There's a good comment in the nextjs repo about the issue and an optimal solution from this package here vercel/next.js#54220 (comment). Would be great if we could apply the solution here so that the components can be easily consumed in client components 🙌
https://github.com/kinde-oss/kinde-auth-react”
1.8.12
Windows
Ventura 13.2
No response
No response
No response
I launched my product with kinde's auth here: https://the-abc.tech
I did most of the things correctly.
https://github.com/kinde-oss/kinde-auth-nextjs/
2.2.5
macOS
14.4.1
No response
No response
Hello,I am currently working on integrating Hasura with the Kinde Auth application. I'm facing an issue with creating JWT claims and adding them to the token. Here are the steps I've attempted, but encountered difficulties:
I've been trying to generate JWT claims for the integration.I need guidance on how to properly add these claims to the token for seamless integration with Hasura.Could someone provide guidance or a step-by-step tutorial on how to achieve this integration between Kinde Auth and Hasura?Thank you in advance for your help.
No response
There's an edge-case bug in the authMiddleware
found in src/authMiddleware/authMiddleware.js
where the middleware authentication fails with a TypeError
if the postLogoutRedirectURL
environment variable is not set. This results from the trimTrailingSlash
function being called with an undefined value.
Happy to do any of the suggested fixes, just wanted to check before submitting. Or we could just close with RTFM of setting the value of course (I was testing and took it out)
postLogoutRedirectURL
environment variable is not set.authMiddleware
by browsing to a directory that encompassed by the matcherThe middleware should handle the absence of postLogoutRedirectURL
gracefully, either by falling back to a default value or by providing a clear error message indicating that the postLogoutRedirectURL
configuration is missing.
A TypeError: Cannot read properties of undefined (reading 'charAt')
error is thrown, stemming from the trimTrailingSlash
function.
There are several ways to address this issue:
Input Validation:
trimTrailingSlash
.const logoutUrl = config.postLogoutRedirectURL ? trimTrailingSlash(config.postLogoutRedirectURL) : undefined;
Configuration Validation:
Fail the configuration load if postLogoutRedirectURL is not set, providing a clear error message to the developer.
Default Value: Provide a default value for postLogoutRedirectURL in case it's not set.
Error Handling: Enhance error handling within trimTrailingSlash to cope with undefined inputs gracefully.
https://github.com/kinde-oss/kinde-auth-nextjs
1.8.21
macOS
Mac OS 14.0
No response
No response
No response
Neither AuthProvider
nor KindeBrowserClient
respect the token expiry times and don't handle expired sessions and re-authentication. There is no mention of expiration handling anywhere in docs. Nothing in source code.
After the token expires, if the app is still open and tries to fetch data (as most RIA apps do) everything will start failing - i.e. with 405
as described in #171 or plain 403
401
.
All other auth sdks I know provide implicit or explicit expiration handling - usually by checking the exp
claim and making sure that before it expires (with some buffer), token is regenerated or redirection happens to auth page/route to prevent errors.
https://github.com/kinde-oss/kinde-auth-nextjs
2.2.10
macOS
23E224
No response
No response
No response
I am trying to setup a custom login page as described in the documentation with Nextjs
`import { useKindeAuth } from '@kinde-oss/kinde-auth-nextjs';
function SignInButton() {
const { login } = useKindeAuth();
return (
<button onClick={() => login({
authUrlParams: {
connection_id: "conn_e5f80aa5258e4685bf629b38003ee954",
login_hint: "[email protected]"
}
})}>
Sign in with email
</button>
);
}`
But i keep getting the error response
Property 'login' does not exist on type 'KindeState'.
at the point where i try importing the login method.
https://github.com/kinde-oss/kinde-auth-nextjs
2.2.3
Windows
Ubuntu linux
No response
No response
No response
"use client";
import { useKindeBrowserClient } from "@kinde-oss/kinde-auth-nextjs";
export function Page() {
const {
isLoading,
isAuthenticated,
} = useKindeBrowserClient();
return <div>{isAuthenticated}</div>
}
Every time the component is rendered, and the user is not currently logged in, it spams this error into our platform error logs:
Error: Cannot get user details, no authentication credential found
at eval (webpack-internal:///(rsc)/./node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/clients/server/authorization-code.js:166:31)
at step (webpack-internal:///(rsc)/./node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/clients/server/authorization-code.js:50:23)
at Object.eval [as next] (webpack-internal:///(rsc)/./node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/clients/server/authorization-code.js:31:53)
at fulfilled (webpack-internal:///(rsc)/./node_modules/@kinde-oss/kinde-typescript-sdk/dist/sdk/clients/server/authorization-code.js:22:58)
https://github.com/kinde-oss/kinde-auth-nextjs
2.2.3
macOS
n/a
Next.js 14.2.2
No response
No response
getting this
The specified organization could not be found.
https://github.com/kinde-oss/kinde-auth-react
3.0.15
macOS
macOS Catalina 10.15.7
No response
No response
No response
When loging a user out via the /api/auth/logout?post_logout_redirect_url=/login?type=bewerben url it redirects me to my POST_LOGOUT_REDIRECT_URL I have set in my .env in this case /login without the additional params. I also changed this in the env to be /dashboard and as expected I get forwarded to /dashboard instead of /login?type=bewerben.
https://github.com/kinde-oss/kinde-auth-nextjs
2.1.15
Windows
11 Version 23H2 (Build 22631.3155)
Node: v18.18.2
NextJS: 13.4.19
No response
No response
According to the following Kinde OSS template, there should be a link to the related starter kit (if it exists): https://github.com/kinde-oss/kinde-oss-repo-template/blob/main/README_template_non-generator.md
N/A
No response
I used the document at https://kinde.com/docs/developer-tools/nextjs-sdk/ to set up my next.js project. However, I encountered a typescript issue mentioned in the title.
https://github.com/kinde-oss/kinde-auth-nextjs
1.9.1
macOS
macOS 14.1.2 Chrome Version 121.0.6167.139
No response
No response
No response
When I use Edge functions with the last version of library, an error appears Error [TypeError]: Native module not found: cookie.
export const runtime = 'edge';
export async function POST(req:NextRequest){
const {getUser} = getKindeServerSession()
const user = await getUser()
}
This code you can see here doesnt works and generate the problem, but when you set this api route as no edge function it gives the error descriped
https://github.com/kinde-oss/kinde-auth-nextjs
"@kinde-oss/kinde-auth-nextjs": "^2.0.4",
Windows
Windows 11
No response
No response
No response
I was able to get setup with the NextJS SDK by downgrading to my Node version to 16.20.2
I would expect the Kinde NextJS SDK to work with Node v18
I would like to see the Kinde NextJS SDK work with v18
No response
The alignment of the title's text can be so off depending on its length...
Please provide an input to change it just like we can change the alignment of the whole component relative to the page.
I'm setting up Kinde for the first time and I need to have a few other middleware along with the include authMiddleware. I've looked through docs and other areas and can't find an example on how to do this.
I've done this setup before following https://reacthustle.com/blog/how-to-chain-multiple-middleware-functions-in-nextjs as an example how to chain middleware but when I do this option I get an error back from the authMiddleware.
Is there any guidance that could be given? It should would be handy to have an example in the documentation.
Trying to use multiple middleware in NextJS
No response
I am getting 500 error during redirect to /api/auth/kinde_callback
https://github.com/kinde-oss/kinde-auth-react
^2.2.11
macOS
14.5 (23F79)
No response
https://github.com/kingRayhan/kinde-play
No response
I followed the guide here:
https://kinde.com/docs/developer-tools/nextjs-sdk/
When I create a Link component and send the user to /api/auth/login, the user is able to request a OTP, but the response once they input the OTP is:
Authentication error
URL: https://mysite.kinde.com/auth/cx/_:nav&m:auth_error
The web console does not show any information regarding this error.
I am able to use the import {RegisterLink, LoginLink} from "@kinde-oss/kinde-auth-nextjs/server";
without issue.
I tried creating both server and client components
https://github.com/kinde-oss/kinde-auth-nextjs
1.8.16
Other Linux
Fedora 38
Node version: 20.5.1
No response
No response
I have a user logged in a local environment (me) sending a request to a api route, but, even when im logged in, and passing the request & response instances, the getKindeServerSession(request, response) is returning false.
Code:
import { getKindeServerSession } from "@kinde-oss/kinde-auth-nextjs/server";
export async function GET(request: Request, res: Response) {
const {isAuthenticated} = getKindeServerSession();
console.log(await isAuthenticated())
return Response.json({ Ola: true })
}
https://github.com/kinde-oss/kinde-auth-nextjs
2.0.6
Windows
11
No response
No response
No response
After redirect back to Nextjs page, it seems that user
cookie is not set. User cookie is expected in authMiddleware
if (isAuthorized && onSuccess) {
return await onSuccess({
token: accessTokenValue,
user: JSON.parse(req.cookies.get('user').value)
});
}
Because user cookie is not present, this is throwing reading from undefined error.
I found this, by removing all cookies and site data and refreshing the page. I've checked my setup and it's same as in the guide.
export default withAuth(async function middleware(request: NextRequest) {
const pathname = request.nextUrl.pathname;
// Home page does not need any special protection
if (
!pathname ||
pathname === "" ||
pathname === "/" ||
pathname.startsWith("/new")
)
return;
import { handleAuth } from "@kinde-oss/kinde-auth-nextjs/server";
export const GET = handleAuth();
I'm not sure why it occurred right now, I tested with previous version of library and same issue is happening. My wild guess is that maybe it's not about the library but something else has changed?
https://github.com/kinde-oss/kinde-auth-react
2.2.4
macOS
Sonoma 14.4.1
Newest version of Nextjs, Web browser: Newest Firefox, tested with github auth and email/password login
No response
No response
The TS types are lying:
export type KindeOrganization = {
orgCode: string | null;
};
export type KindeState = {
organization: KindeOrganization;
getOrganization: () => KindeOrganization;
getUserOrganizations: () => KindeOrganizations | null;
};
but when running the code I'm getting:
https://github.com/kinde-oss/kinde-auth-nextjs
2.2.3
macOS
n/a
Next.js 14.2.2
No response
No response
I am using Kinde with a Next.js application. In my business login, I would like to retrieve user roles based on the user's ID. I am currently using the "createKindeManagementAPIClient" but it doesn't have a method to fetch the specific user roles. Furthermore, the access_token does not contain the roles information. Could you kindly assist me in retrieving the roles of a specific user?
Thanks.
I am using Kinde with a Next.js application. In my business login, I would like to retrieve user roles based on the user's ID. I am currently using the "createKindeManagementAPIClient" but it doesn't have a method to fetch the specific user roles. Furthermore, the access_token does not contain the roles information. Could you kindly assist me in retrieving the roles of a specific user?
codes:
const enforceUserIsAuthenticated = t.middleware(async ({ ctx, next }) => {
const {usersApi, rolesApi} = await createKindeManagementAPIClient();
const { isAuthenticated, email, userId } = ctx.session!;
console.log("[protected Procedure", await usersApi.getUsers({userId}));
console.log("[protected Procedure", await rolesApi.getRoles({
}));
if (!isAuthenticated || !email || !userId) {
throw new TRPCError({ code: "UNAUTHORIZED" });
}
return next({
ctx,
});
});
No response
Hi,
when i try to run pnpm build
this type error occurs:
.next/types/app/api/auth/[kindeAuth]/route.ts:59:7:
Type error: Type '{ __tag__: "GET"; __return_type__: Promise<(req: any, res: any) => any>; }' does not satisfy the constraint '{ __tag__: "GET"; __return_type__: void | Response | Promise<void | Response>; }'.
Types of property '__return_type__' are incompatible.
Type 'Promise<(req: any, res: any) => any>' is not assignable to type 'void | Response | Promise<void | Response>'.
Type 'Promise<(req: any, res: any) => any>' is not assignable to type 'Promise<void | Response>'.
Type '(req: any, res: any) => any' is not assignable to type 'void | Response'.
57 | __return_type__: Response | void | never | Promise<Response | void | never>
58 | },
> 59 | {
| ^
60 | __tag__: 'GET',
61 | __return_type__: ReturnType<MaybeField<TEntry, 'GET'>>
62 | },
Node version: 19.3.0
My package.json:
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.501.0",
"@aws-sdk/s3-presigned-post": "^3.501.0",
"@aws-sdk/s3-request-presigner": "^3.501.0",
"@kinde-oss/kinde-auth-nextjs": "^2.1.5",
"@prisma/client": "^5.7.1",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-navigation-menu": "^1.1.4",
"@radix-ui/react-scroll-area": "^1.0.5",
"@radix-ui/react-separator": "^1.0.3",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-tabs": "^1.0.4",
"@tailwindcss/typography": "^0.5.10",
"@tanstack/react-query": "^4.36.1",
"@trpc/client": "^10.44.1",
"@trpc/next": "^10.44.1",
"@trpc/react-query": "^10.44.1",
"@trpc/server": "^10.44.1",
"@types/multer": "^1.4.11",
"aws-sdk": "^2.1545.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"filepond": "^4.30.6",
"filepond-plugin-file-validate-type": "^1.2.8",
"lucide-react": "^0.316.0",
"multer": "1.4.5-lts.1",
"next": "14.1.0",
"next-connect": "^1.0.0",
"next-themes": "^0.2.1",
"react": "^18",
"react-dom": "^18",
"react-dropzone": "^14.2.3",
"react-filepond": "^7.1.2",
"react-hook-form": "^7.49.3",
"tailwind-merge": "^2.1.0",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.22.4"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.4",
"postcss": "^8",
"prisma": "^5.7.1",
"tailwindcss": "^3.3.0",
"typescript": "^5"
}
}
Any idea how to fix this error?
Thanks
https://github.com/kinde-oss/kinde-auth-react
2.1.5
Windows
Windows 11
No response
No response
No response
Unable to use the SDK with edge runtime as it crashes trying to import node crypto
, probably from transient jwt-decode
or crypto-js
🤷
import { getKindeServerSession } from "@kinde-oss/kinde-auth-nextjs/server";
export const runtime = "edge";
export default function Home() {
const { getUser, isAuthenticated } = getKindeServerSession();
const user = getUser();
return <></>;
}
- error ./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@kinde-oss/kinde-auth-nextjs/dist/server/index.js:1:960
Module not found: Can't resolve 'crypto'
https://nextjs.org/docs/messages/module-not-found
https://github.com/kinde-oss/kinde-auth-react%E2%80%9D
1.8.16
Other Linux
.
next 13.4.19
No response
No response
test
test
No response
After authenticating calling the getUserOrganizations
method is returning undefined when user is a member of multiple organizations
import { useKindeAuth } from '@kinde-oss/kinde-auth-react';
const { getUserOrganizations } = useKindeAuth();
// After user authentication
const userOrganizations = await getUserOrganizations();
console.log(userOrganizations);
// {orgCodes: undefined }
Expected
// {orgCodes:['org_1', 'org_2'] }
### Library URL
https://github.com/kinde-oss/kinde-auth-nextjs
### Library version
Current
### Operating system(s)
macOS
### Operating system version(s)
Ventura
### Further environment details
_No response_
### Reproducible test case URL
_No response_
### Additional information
_No response_
Following the NextJS guide, I constantly see the following error in my console
This setup fetch
call in this effect is always failing with 401
error.
The response just says "Login with Kinde".
At the moment it appears to be a red herring since I'm able to login anyways, but thought i'd report, since either the guide is missing a step, there's a bug with the SDK or I'm doing something wrong.
Thanks!
https://github.com/kinde-oss/kinde-auth-nextjs
^2.2.10
macOS
Sonoma 14.5
No response
No response
No response
Almost every function returned from getKindeServerSession()
is of type Promise<any>
. For example:
export default function Page() {
const { getUser } = getKindeServerSession()
// getUser returns Promise<any>, instead of Promise<KindeUser>
}
I think that this commit is responsible for that bug: 089cda615f5238246204a148333ac8c3887a4f24
https://github.com/kinde-oss/kinde-auth-nextjs
^2.0.0
macOS
Sonoma
No response
No response
No response
POST
request to one of the api routes (or invoked a server action)POST /api/auth/login
The handler redirects to login, or better yet, allows to handle it otherwise to inform the front-end that session has expired and user needs to be logged in again.
🔴/api/auth/login?post_login_redirect_url=... 405 Method Not Allowed
https://github.com/kinde-oss/kinde-auth-react
2.2.10
macOS
23E224
No response
No response
No response
We are experiencing an issue in our Next.js application where the getAccessToken function from the @kinde-oss/kinde-auth-nextjs SDK consistently returns null even after a successful login and logout process.
https://github.com/kinde-oss/kinde-auth-nextjs
2.0.10
macOS
14.1.1
Environment:
Node.js Version: v20.8.1
Next.js Version: 13.5.6
Kinde Auth Next.js SDK Version: 2.0.10
React Version: 18.x
Additional Dependencies:
@headlessui/react, @heroicons/react, @radix-ui/react-*, clsx, fs, lucide-react, tailwind-merge, tailwindcss-animate
No response
No response
Cannot find module '@kinde-oss/kinde-auth-nextjs/components' or its corresponding type declarations
I reinstall that libary but still doesn't work,
The files ```[pawitsahare@jac node_modules]$ cd @kinde-oss/kinde-auth-nextjs/
Video
Screencast from 2023-11-11 06-26-19.webm
[pawitsahare@jac kinde-auth-nextjs]$ tree
.
├── dist
│ ├── cjs
│ │ ├── index.js
│ │ └── index.js.map
│ ├── components
│ │ ├── cjs
│ │ │ ├── index.js
│ │ │ └── index.js.map
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ └── index.js.map
│ ├── index.d.ts
│ ├── index.js
│ ├── index.js.map
│ ├── middleware
│ │ ├── cjs
│ │ │ ├── index.js
│ │ │ └── index.js.map
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ └── index.js.map
│ ├── server
│ │ ├── cjs
│ │ │ ├── index.js
│ │ │ └── index.js.map
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ └── index.js.map
│ ├── types
│ │ ├── api-client.d.ts
│ │ ├── api-client.d.ts.map
│ │ ├── components
│ │ │ ├── CreateOrgLink.d.ts
│ │ │ ├── CreateOrgLink.d.ts.map
│ │ │ ├── index.d.ts
│ │ │ ├── index.d.ts.map
│ │ │ ├── LoginLink.d.ts
│ │ │ ├── LoginLink.d.ts.map
│ │ │ ├── LogoutLink.d.ts
│ │ │ ├── LogoutLink.d.ts.map
│ │ │ ├── RegisterLink.d.ts
│ │ │ └── RegisterLink.d.ts.map
│ │ ├── config
│ │ │ ├── index.d.ts
│ │ │ └── index.d.ts.map
│ │ ├── frontend
│ │ │ ├── AuthProvider.d.ts
│ │ │ ├── AuthProvider.d.ts.map
│ │ │ ├── index.d.ts
│ │ │ ├── index.d.ts.map
│ │ │ ├── KindeBrowserClient.d.ts
│ │ │ └── KindeBrowserClient.d.ts.map
│ │ ├── handlers
│ │ │ ├── auth.d.ts
│ │ │ ├── auth.d.ts.map
│ │ │ ├── callback.d.ts
│ │ │ ├── callback.d.ts.map
│ │ │ ├── createOrg.d.ts
│ │ │ ├── createOrg.d.ts.map
│ │ │ ├── login.d.ts
│ │ │ ├── login.d.ts.map
│ │ │ ├── logout.d.ts
│ │ │ ├── logout.d.ts.map
│ │ │ ├── register.d.ts
│ │ │ ├── register.d.ts.map
│ │ │ ├── setup.d.ts
│ │ │ └── setup.d.ts.map
│ │ ├── index.d.ts
│ │ ├── index.d.ts.map
│ │ ├── middleware
│ │ │ ├── index.d.ts
│ │ │ └── index.d.ts.map
│ │ ├── routerClients
│ │ │ ├── AppRouterClient.d.ts
│ │ │ ├── AppRouterClient.d.ts.map
│ │ │ ├── PagesRouterClient.d.ts
│ │ │ ├── PagesRouterClient.d.ts.map
│ │ │ ├── RouterClient.d.ts
│ │ │ └── RouterClient.d.ts.map
│ │ ├── server
│ │ │ ├── index.d.ts
│ │ │ └── index.d.ts.map
│ │ ├── session
│ │ │ ├── getAccessToken.d.ts
│ │ │ ├── getAccessToken.d.ts.map
│ │ │ ├── getBooleanFlag.d.ts
│ │ │ ├── getBooleanFlag.d.ts.map
│ │ │ ├── getFlag.d.ts
│ │ │ ├── getFlag.d.ts.map
│ │ │ ├── getIdToken.d.ts
│ │ │ ├── getIdToken.d.ts.map
│ │ │ ├── getIntegerFlag.d.ts
│ │ │ ├── getIntegerFlag.d.ts.map
│ │ │ ├── getOrganization.d.ts
│ │ │ ├── getOrganization.d.ts.map
│ │ │ ├── getPermission.d.ts
│ │ │ ├── getPermission.d.ts.map
│ │ │ ├── getPermissions.d.ts
│ │ │ ├── getPermissions.d.ts.map
│ │ │ ├── getStringFlag.d.ts
│ │ │ ├── getStringFlag.d.ts.map
│ │ │ ├── getUser.d.ts
│ │ │ ├── getUser.d.ts.map
│ │ │ ├── getUserOrganizations.d.ts
│ │ │ ├── getUserOrganizations.d.ts.map
│ │ │ ├── index.d.ts
│ │ │ ├── index.d.ts.map
│ │ │ ├── isAuthenticated.d.ts
│ │ │ ├── isAuthenticated.d.ts.map
│ │ │ ├── kindeServerClient.d.ts
│ │ │ ├── kindeServerClient.d.ts.map
│ │ │ ├── sessionManager.d.ts
│ │ │ └── sessionManager.d.ts.map
│ │ └── utils
│ │ ├── appRouter
│ │ │ ├── prepareForRedirect.d.ts
│ │ │ ├── prepareForRedirect.d.ts.map
│ │ │ ├── setVerifierCookie.d.ts
│ │ │ └── setVerifierCookie.d.ts.map
│ │ ├── base64Encode.d.ts
│ │ ├── base64Encode.d.ts.map
│ │ ├── generateAuthUrl.d.ts
│ │ ├── generateAuthUrl.d.ts.map
│ │ ├── generateCallbackUrl.d.ts
│ │ ├── generateCallbackUrl.d.ts.map
│ │ ├── isAppRouter.d.ts
│ │ ├── isAppRouter.d.ts.map
│ │ ├── pageRouter
│ │ │ ├── isTokenValid.d.ts
│ │ │ ├── isTokenValid.d.ts.map
│ │ │ ├── prepareForRedirect.d.ts
│ │ │ ├── prepareForRedirect.d.ts.map
│ │ │ ├── setVerifierCookie.d.ts
│ │ │ └── setVerifierCookie.d.ts.map
│ │ ├── pkceChallenge.d.ts
│ │ ├── pkceChallenge.d.ts.map
│ │ ├── pkceChallengeFromVerifier.d.ts
│ │ ├── pkceChallengeFromVerifier.d.ts.map
│ │ ├── randomString.d.ts
│ │ ├── randomString.d.ts.map
│ │ ├── sanitizeRedirect.d.ts
│ │ ├── sanitizeRedirect.d.ts.map
│ │ ├── setupChallenge.d.ts
│ │ ├── setupChallenge.d.ts.map
│ │ ├── sha256.d.ts
│ │ ├── sha256.d.ts.map
│ │ ├── version.d.ts
│ │ └── version.d.ts.map
│ └── types.d.ts
├── LICENSE
├── node_modules
├── package.json
├── readme.md
└── types.d.ts
22 directories, 133 files```
I don't known why the erorr is showing but i tried using import {RegisterLink, LoginLink} from "@kinde-oss/kinde-auth-nextjs/dist/components"; still the module not found, please help also tried the building the application but still not working
06:02:15.287 | Type error: Cannot find module '@kinde-oss/kinde-auth-nextjs/components' or its corresponding type declarations.
06:02:15.287 |
06:02:15.287 | 1 | "use client"
06:02:15.287 | > 2 | import {RegisterLink, LoginLink} from "@kinde-oss/kinde-auth-nextjs/components";
06:02:15.287 | | ^
06:02:15.287 | 3 |
06:02:15.287 | 4 | import NextLink from "next/link";
06:02:15.288 | 5 | import React from "react";
06:02:15.381 | ELIFECYCLE Command failed with exit code 1.
06:02:15.398 | Error: Command "pnpm run build" exited with 1
https://github.com/kinde-oss/kinde-auth-react
2.0.5
Other Linux
Fedora 38
No response
No response
I tried everything that possible,
Can't get user's orgs names. I'd like to let the user know which org they have logged into and also offer the option to switch orgs.
Functions getOrganization and getUserOrganizations could return not only org codes but also org names.
using import { getKindeServerSession } from '@kinde-oss/kinde-auth-nextjs/server'
In user panel, enable Settings -> Applications -> ... -> Tokens -> Access Token -> Organisation Name (string)
Then augment the module to add the missing property:
// i.e. src/types/kinde.d.ts
declare module "@kinde-oss/kinde-auth-nextjs" {
export type KindeOrganization = {
orgName: string | null;
};
}
KindeOrganization
should now contain both orgName
and orgCode
The whole module is now broken, all imports are failing, i.e.
Module '"@kinde-oss/kinde-auth-nextjs"' has no exported member 'useKindeBrowserClient'.ts(2305)
https://github.com/kinde-oss/kinde-auth-nextjs
2.2.3
macOS
n/a
Next.js 14.2.2
No response
No response
src/app/api/auth/[kindeAuth]/route.ts
Type error: Route "src/app/api/auth/[kindeAuth]/route.ts" does not match the required types of a Next.js Route.
Invalid configuration "GET":
Expected "Function", got "Promise<void | Response> | ((req: NextApiRequest | Request, res: Response | NextApiResponse<any>) => Promise<...>)".
https://github.com/kinde-oss/kinde-auth-react
2.0.9
macOS
14.0 (23A344)
No response
No response
No response
Basically, I want to create a signup API where I will create a separate organization for every user signed up. I planned to create an organization like this <username>'s space
name. I was digging through documentation, I found this createKindeManagementAPIClient
.
It has lots of helpful methods for managing kinde management API. I attempted the way below but every time I got bad request. Maybe I am making some silly mistake.
https://github.com/kinde-oss/kinde-auth-react
^2.2.11
macOS
14.5 (23F79)
No response
https://github.com/kingRayhan/kinde-play-org
No response
When click on register link or login link it throw me HTTP 500 error code and the url which i redirect by clicking the login link is http://localhost:3000/api/auth/register?
i have app router and i have write the code for login and register link in page.js of home or root
version of next js "next": "^13.5.6",
version of kinde "@kinde-oss/kinde-auth-nextjs": "^2.0.1",
node version 16.20.0
https://github.com/kinde-oss/kinde-auth-nextjs
2.0.1
Other Linux
Linux mint 20 Cinnamon ,Cinnamon version 4.6.6
No response
No response
No response
Hi,
I have an issue when using this SDK to login.
As i checked, when users login to Kinde, the maximum age of the code_verifer cookie is 60s
const { state, code_challenge } = setupChallenge(req, res, 60);
This is a problem if the session logs in and inserts the code in more than 60s then the SDK cannot verify because the code_verifier has been removed.
My suggestion is that the SDK allow the user to configure the maximum age of code_verifer
In the same way that dynamic post login urls are allowed, it would be useful to allow the same for logout.
For example to allow both:
api/auth/logout?post_logout_redirect_uri=product1/login
api/auth/logout?post_logout_redirect_uri=product2/login
a post_logout_redirect_uri
parameter that can be passed to the logout url something like
<Link
href={{
pathname: "/api/auth/logout",
query: {
post_logout_redirect_url: "/product2/login"
}
}}
>
Log out
</Link>
No response
Hi, I just tried to get server session for isAuthenticated method for switch for two buttons display but this happen only here
import { getKindeServerSession } from "@kinde-oss/kinde-auth-nextjs/server";
export const Navs = async () => {
const { isAuthenticated } = getKindeServerSession();
const logged = await isAuthenticated();
return (
<nav className="flex gap-4">
{logged ? (
<div className="flex w-fit items-center gap-4">
<Button variant={"link"} asChild>
<Link href={"/dashboard"}>Dashboard</Link>
</Button>
<AccountMenu />
</div>
) : (
<div className="flex items-center gap-4">
<Button variant={"link"} asChild>
<LoginLink>SignIn</LoginLink>
</Button>
<Button variant={"link"} asChild>
<RegisterLink>SignUp</RegisterLink>
</Button>
</div>
)}
<ModeToggle />
</nav>
);
};
export default Navs;
console:
TypeError: (0 , react__WEBPACK_IMPORTED_MODULE_0__.createContext) is not a function
at eval (webpack-internal:///(rsc)/./node_modules/@kinde-oss/kinde-auth-nextjs/dist/index.js:16:11560)
at (rsc)/./node_modules/@kinde-oss/kinde-auth-nextjs/dist/index.js (D:\Big Projects\minecraft-client\.next\server\vendor-chunks\@kinde-oss.js:30:1)
at __webpack_require__ (D:\Big Projects\minecraft-client\.next\server\webpack-runtime.js:33:43)
at eval (webpack-internal:///(rsc)/./app/(main)/_components/nav.tsx:9:86)
at (rsc)/./app/(main)/_components/nav.tsx (D:\Big Projects\minecraft-client\.next\server\app\(main)\(routes)\dashboard\server\[id]\(routes)\main\page.js:563:1)
at __webpack_require__ (D:\Big Projects\minecraft-client\.next\server\webpack-runtime.js:33:43)
at eval (webpack-internal:///(rsc)/./app/(main)/_components/header.tsx:7:62)
at (rsc)/./app/(main)/_components/header.tsx (D:\Big Projects\minecraft-client\.next\server\app\(main)\(routes)\dashboard\server\[id]\(routes)\main\page.js:552:1)
at __webpack_require__ (D:\Big Projects\minecraft-client\.next\server\webpack-runtime.js:33:43)
at eval (webpack-internal:///(rsc)/./app/(main)/layout.tsx:7:76) {
type: 'TypeError',
page: '/dashboard/server/MfQxfjWwo7RrBrnLeO4o/main'
}
https://github.com/kinde-oss/kinde-auth-nextjs
2.2.6
Windows
Windows 11 version 22H2
package.json
{
"name": "minecraft-client",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@hookform/resolvers": "^3.3.4",
"@kinde-oss/kinde-auth-nextjs": "^2.2.6",
"@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-tabs": "^1.0.4",
"@typeschema/zod": "^0.13.3",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"drizzle-orm": "^0.30.10",
"firebase": "^10.11.1",
"framer-motion": "^11.1.9",
"ldrs": "^1.0.1",
"lucide-react": "^0.378.0",
"mineflayer": "^4.20.1",
"net": "^1.0.2",
"next": "14.2.3",
"next-safe-action": "^6.2.0",
"next-themes": "^0.3.0",
"react": "^18",
"react-dom": "^18",
"react-hook-form": "^7.51.4",
"sonner": "^1.4.41",
"tailwind-merge": "^2.3.0",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.6"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.3",
"postcss": "^8",
"supabase": "^1.165.0",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
}
No response
No response
When unauthenticated, getToken
is not a function, it just has the value undefined
.
useEffect(() => {
console.log(`isAuthenticated: ${isAuthenticated}`);
console.log(`getToken: ${getToken}`);
if (getToken) {
console.log(`getToken(): ${getToken()}`);
}
console.log(`user: ${JSON.stringify(user)}`);
}, [isAuthenticated, getToken, user]);
console.log
returns:
isAuthenticated: false
getToken: undefined
user: null
The issue comes from the AuthProvider file AuthContext
initial state, lacks the property getToken
:
const AuthContext = createContext({
...config.initialState,
user: handleError,
isLoading: handleError
});
https://github.com/kinde-oss/kinde-auth-nextjs
1.8.2
macOS
macOS Ventura 13.2.1
All browsers
Framework: NextJS v12
No response
No response
When using the getUser function from getKindeServerSession to get the user id in generateStaticParams (Nextjs 14.0.2 App Router) inside nested page route (/posts/[slug]), it throws this error... (Error: Invariant: cookies() expects to have requestAsyncStorage, none available)
https://github.com/kinde-oss/kinde-auth-nextjs
1.8.25
Ubuntu
22.04
Node v20
Firefox v118
No response
I'm attempting to retrieve the username property for users that have usernames set. However, the getUser method from the getKindeServerSession function only returns an object with the following properties:
{
"family_name": "family name",
"given_name": "given name",
"picture": "picture_url",
"email": "email",
"id": "idString",
"properties": {
"city": undefined,
"industry": undefined,
"job_title": undefined,
"middle_name": undefined,
"postcode": undefined,
"salutation": undefined,
"state_region": undefined,
"street_address": undefined,
"street_address_2": undefined
}
}
The username property is missing from the response despite the fact that users do have usernames set.
Steps to Reproduce
Import the getKindeServerSession function from @kinde-oss/kinde-auth-nextjs/server.
Call the getUser method.
Observe the response object.
import { getKindeServerSession } from "@kinde-oss/kinde-auth-nextjs/server";
export default async function Home() {
const { getUser } = getKindeServerSession();
const user = await getUser();
console.log(user);
return (
<div>
<pre>{JSON.stringify(user, null, 2)}</pre>
</div>
);
}
Expected Behavior
The response object from the getUser method should include the username property if it is set for the user.
Actual Behavior
The getUser method returns an object without the username property, even for users who have usernames set.
Verification
I have contacted support and verified that users do indeed have the username property set. This was confirmed by using the Kinde Management API to retrieve user objects, which included the username property.
Environment
Package Version: @kinde-oss/kinde-auth-nextjs "^2.2.13"
Node.js Version: v21.1.0
https://github.com/kinde-oss/kinde-auth-nextjs
"2.2.13"
macOS
macOS Sonoma 14.4.1
No response
No response
No response
When the user logs out and the app tries to read the new authentication state, an unexpected error causes the auth state to perpetually load with the error "End of JSON Input" showing up on the client and the error below showing on the server
https://github.com/kinde-oss/kinde-auth-nextjs/
"^2.1.5"
Windows
Windows 11
No response
No response
No response
With the 2.0.0 version, this does not work:
import { authMiddleware } from '@kinde-oss/kinde-auth-nextjs/server'
export const config = {
matcher: ['/dashboard/:path*', '/auth-callback'],
}
export default authMiddleware
The matched routes are always locked, even if logged in.
This workaround works:
import { withAuth } from '@kinde-oss/kinde-auth-nextjs/server'
export const config = {
matcher: ['/dashboard/:path*', '/auth-callback'],
}
export default withAuth(async function middleware(req: any) {}, {
isAuthorized: ({ user }: { user: any }) => {
return user?.id
},
})
https://github.com/kinde-oss/kinde-auth-nextjs
2.0.0
macOS
14.0
Next 14
No response
No response
I'm trying to use @kinde-oss/kinde-auth-nextjs on a new nextjs project, after running 'pnpm install' and 'pnpm dev', I'm getting the following error
Uncaught TypeError: Cannot read properties of undefined (reading 'charAt')
at y (webpack-internal:///(middleware)/./node_modules/.pnpm/@kinde-oss[email protected][email protected][email protected]/node_modules/@kinde-oss/kinde-auth-nextjs/dist/server/index.js:270:26)
at Object.k [as handler] (webpack-internal:///(middleware)/./node_modules/.pnpm/@kinde-oss[email protected][email protected][email protected]/node_modules/@kinde-oss/kinde-auth-nextjs/dist/server/index.js:273:38)
at adapter (webpack-internal:///(middleware)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/esm/server/web/adapter.js:185:33)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
https://github.com/gitdagray/kinde-auth-nextjs
^1.8.18
Other (see “Further environment details”)
Windows 11
WSL 2 Ubuntu
https://github.com/gitdagray/kinde-auth-nextjs
No response
Issue
When using kinde-auth-nextjs
with app dir routing and a basePath set, useKindeBrowserClient
cannot be used.
Cause
The fetch("/api/auth/setup")
located here doesn't take the basePath into consideration. The result is a 404 Not Found and no auth data returned.
Resolution
Not quite sure right now to be honest. You used to be able to get the basePath
from the router, but that was removed in 14. Perhaps another env var? Or an optional options argument for useKindeBrowserClient
. I can submit a PR if you wish with your desired plan of attack.
https://github.com/kinde-oss/kinde-auth-nextjs
2.1.7
Other Linux
Arch Linux
No response
No response
No response
Since v2.2.2 the type exports have changed, which breaks my integration and it no longer seems possible to import certain types, especially KindeAccessToken
, KindeIdToken
and KindeUser
that were previously exposed through import type { KindeAccessToken, KindeIdToken, KindeUser } from '@kinde-oss/kinde-auth-nextjs/types';
Those types now live in dist/types.d.ts
but there is no export for those in package.json
and they do not seem to be re-exported through any other exports listed there.
It'd be great if you could expose them again or provide information how we can still access them. I would not consider this a minor change unless those types were never meant to be exposed.
https://github.com/kinde-oss/kinde-auth-nextjs
2.2.2
macOS
14.2.1
No response
No response
No response
When deployed to CF Pages via the @cloudflare/next-on-pages package, user requests to /api/auth/[kindeAuth]
are not resolved correctly and show a "Internal Server Error"
This does not happen in development and seems to also affect Vercel deployments as well.
https://github.com/kinde-oss/kinde-auth-nextjs
2.0.13
macOS
14.2 Beta (23C5030f)
No response
No response
There are no changes to the library or any special changes to how this library is implemented.
The most recent docs have followed word for word and since the entire auth flow works on development, I can assume I set it up correctly
I can share my project on a person-by-person basis
Wanted to try out the new refreshTokens as documented here:
https://docs.kinde.com/developer-tools/sdks/backend/nextjs-sdk/#refreshing-kinde-data
await refreshTokens() ...always results in "ReferenceError: config is not defined"
Poked around in the repo: https://github.com/kinde-oss/kinde-auth-nextjs/blob/55de0cae4618fb83bb27d23faa616ec9cebbbff0/src/session/index.js
I don't see where the config object that is accessed on line 35 is defined or imported. It would only reach that spot if another error occurred, but I can't see what that might be yet.
https://github.com/kinde-oss/kinde-auth-nextjs
2.2.6
Windows
Windows 10 Pro
No response
No response
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.