Beta
The Neon Auth with Better Auth is in Beta. Share your feedback on Discord or via the Neon Console.
OAuth lets users sign in with their Google, GitHub, or Vercel account. Neon Auth handles the OAuth flow and creates a session after authorization.
Development mode
Google OAuth is enabled by default with shared credentials for development and testing. You can start using Google sign-in immediately without any configuration.
note
GitHub and Vercel OAuth require custom credentials and is not available with shared credentials. See Production setup to configure your own OAuth apps.
For production, configure your own OAuth app credentials for both providers. See Production setup below.
Sign in with OAuth
Call signIn.social() with your provider ("google", "github" or "vercel"). The SDK redirects the user to the provider's authorization page, then back to your callbackURL:
import { authClient } from './auth';
const handleGoogleSignIn = async () => {
try {
await authClient.signIn.social({
provider: "google",
callbackURL: window.location.origin,
});
} catch (error) {
console.error("Google sign-in error:", error);
}
};Handle the callback
After the provider redirects back to your app, check for a session:
import { authClient } from './auth';
useEffect(() => {
authClient.getSession().then(({ data }) => {
if (data?.session) {
setUser(data.session.user);
}
setLoading(false);
});
}, []);Custom redirect URLs
Specify different URLs for new users or errors:
await authClient.signIn.social({
provider: "google", // or "github", "vercel"
callbackURL: "/dashboard",
newUserCallbackURL: "/welcome",
errorCallbackURL: "/error",
});Production setup
For production, configure your own OAuth app credentials. GitHub and Vercel OAuth require custom credentials, while Google OAuth works with shared credentials for development but should use custom credentials in production.
- Create OAuth apps with your providers:
- In your project's Settings → Auth page, configure your Client ID and Client Secret for each provider
Your app will automatically use your configured credentials
Need help?
Join our Discord Server to ask questions or see what others are doing with Neon. For paid plan support options, see Support.








