Skip to content

Commit

Permalink
♻️ refactor: Remove proxy url settings for NextAuth (lobehub#4826)
Browse files Browse the repository at this point in the history
* ♻️ refactor: remove proxyurl

* ♻️ refactor: remove unused import

* ♻️ refactor: add debug option for nextauth

* 🚨 style: fix lint error
  • Loading branch information
cy948 authored Dec 7, 2024
1 parent 9ff2c03 commit a502c17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/config/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ declare global {

NEXT_AUTH_SSO_PROVIDERS?: string;

NEXT_AUTH_DEBUG?: string;

AUTH0_CLIENT_ID?: string;
AUTH0_CLIENT_SECRET?: string;
AUTH0_ISSUER?: string;
Expand Down Expand Up @@ -156,6 +158,7 @@ export const getAuthConfig = () => {
// NEXT-AUTH
NEXT_AUTH_SECRET: z.string().optional(),
NEXT_AUTH_SSO_PROVIDERS: z.string().optional().default('auth0'),
NEXT_AUTH_DEBUG: z.boolean().optional().default(false),

// Auth0
AUTH0_CLIENT_ID: z.string().optional(),
Expand Down Expand Up @@ -217,6 +220,7 @@ export const getAuthConfig = () => {
NEXT_PUBLIC_ENABLE_NEXT_AUTH: !!process.env.NEXT_AUTH_SECRET,
NEXT_AUTH_SSO_PROVIDERS: process.env.NEXT_AUTH_SSO_PROVIDERS,
NEXT_AUTH_SECRET: process.env.NEXT_AUTH_SECRET,
NEXT_AUTH_DEBUG: !!process.env.NEXT_AUTH_DEBUG,

// Auth0
AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID,
Expand Down
3 changes: 1 addition & 2 deletions src/libs/next-auth/auth.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { NextAuthConfig } from 'next-auth';
import urlJoin from 'url-join';

import { authEnv } from '@/config/auth';

Expand Down Expand Up @@ -40,8 +39,8 @@ export default {
return session;
},
},
debug: authEnv.NEXT_AUTH_DEBUG,
providers: initSSOProviders(),
redirectProxyUrl: process.env.APP_URL ? urlJoin(process.env.APP_URL, '/api/auth') : undefined,
secret: authEnv.NEXT_AUTH_SECRET,
trustHost: process.env?.AUTH_TRUST_HOST ? process.env.AUTH_TRUST_HOST === 'true' : true,
} satisfies NextAuthConfig;

1 comment on commit a502c17

@vercel
Copy link

@vercel vercel bot commented on a502c17 Dec 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.