Performance: Provider configuration (OAuth, credentials)
MEDIUM IMPACT
This affects page load speed and interaction responsiveness by controlling how authentication data is fetched and managed during server and client rendering.
import NextAuth from 'next-auth'; import GoogleProvider from 'next-auth/providers/google'; export default NextAuth({ providers: [ GoogleProvider({ clientId: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID, clientSecret: process.env.GOOGLE_CLIENT_SECRET }) ], secret: process.env.NEXTAUTH_SECRET, session: { strategy: 'jwt' }, callbacks: { async jwt({ token, user }) { if (user) { token.id = user.id; } return token; } } });
import NextAuth from 'next-auth'; import Providers from 'next-auth/providers'; export default NextAuth({ providers: [ Providers.Google({ clientId: process.env.GOOGLE_CLIENT_ID, clientSecret: process.env.GOOGLE_CLIENT_SECRET }) ], callbacks: { async jwt(token, user) { if (user) { token.id = user.id; } return token; } }, session: { jwt: true } });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous env var access and no caching | Minimal | 0 | Blocks initial paint for 100-200ms | [X] Bad |
| Async provider config with caching and NEXT_PUBLIC vars | Minimal | 0 | Non-blocking, fast paint | [OK] Good |