Skip to content

Commit

Permalink
Add an example for implementation with NextAuth (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
byn9826 authored Dec 26, 2024
1 parent 1a3ec6e commit 0809bed
Show file tree
Hide file tree
Showing 21 changed files with 6,356 additions and 4,899 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ docs/.vuepress/.temp
.next/
.expo
expo-env.d.ts
next-env.d.ts
.open-next

.dev.vars
Expand Down
2 changes: 1 addition & 1 deletion admin-panel/app/[lang]/users/[authId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ const Page = () => {
id={`role-${role.id}`}
data-testid='roleInput'
onChange={() => handleToggleUserRole(role.name)}
checked={userRoles?.includes(role.name)}
checked={userRoles?.includes(role.name) ?? false}
/>
<Label
htmlFor={`role-${role.id}`}
Expand Down
9,802 changes: 4,921 additions & 4,881 deletions admin-panel/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions admin-panel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
"classnames": "^2.5.1",
"flowbite-react": "^0.10.1",
"hono": "^4.6.14",
"next": "14.2.14",
"next": "14.2.21",
"next-intl": "^3.15.0",
"react": "^18",
"react-dom": "^18",
"react-redux": "^9.1.2"
},
"devDependencies": {
"@opennextjs/cloudflare": "https://pkg.pr.new/@opennextjs/cloudflare@experimental",
"@opennextjs/cloudflare": "^0.3.2",
"@rtk-query/codegen-openapi": "^1.2.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
Expand Down
2 changes: 1 addition & 1 deletion admin-panel/vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineConfig } from 'vitest/config'
import tsconfigPaths from 'vite-tsconfig-paths'

export default defineConfig({
plugins: [tsconfigPaths()],
plugins: [tsconfigPaths({ root: './' })],
esbuild: {
jsxInject: `import React from 'react'`,
},
Expand Down
2 changes: 1 addition & 1 deletion admin-panel/wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "melody-auth-admin-panel"
main = ".open-next/worker.ts"
main = ".open-next/worker.js"
compatibility_date = "2024-09-23"
compatibility_flags = ["nodejs_compat"]

Expand Down
24 changes: 24 additions & 0 deletions examples/next-auth-js-example/next-auth.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {
DefaultSession, TokenSet,
} from 'next-auth'
import { DefaultJWT } from 'next-auth/jwt'

declare module 'next-auth' {
interface Session extends DefaultSession {
accessToken?: string;
refreshToken?: string;
refreshTokenExpiresOn?: number;
}

interface Account extends Partial<TokenSet> {
refresh_token_expires_on?: number;
}
}

declare module 'next-auth/jwt' {
interface JWT extends DefaultJWT {
accessToken?: string;
refreshToken?: string;
refreshTokenExpiresOn?: number;
}
}
5 changes: 5 additions & 0 deletions examples/next-auth-js-example/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {}

export default nextConfig
Loading

0 comments on commit 0809bed

Please sign in to comment.