Working on a NextJS project after learning React basics
I’m having trouble with NextAuth authentication where it works perfectly with my regular Gmail account but keeps rejecting my university email address.
Here’s what I’m dealing with:
- Regular Gmail: works without issues
- University email: gets access denied error
My university email follows the format [email protected] and is provided by our computer science department. When I try to authenticate with the institutional account, I get an access denied message instead of successful login.
Has anyone encountered similar issues with educational domain emails in NextAuth? Is there a specific configuration needed for non-standard Gmail domains?
University email domains (.edu.bd in your case) usually have stricter OAuth rules than regular Gmail accounts. Your school’s probably using Google Workspace for Education with extra security layers. Check if your OAuth app is set up for external users in Google Cloud Console - sometimes .edu domains need explicit approval even when personal Gmail works perfectly. Your university might also require extra permissions or force you through their own consent screen first. Try logging into your university email in a browser and check your Google account security settings for any pending app requests. Some schools also block OAuth apps from certain countries, which could explain the access denial.
Check your Google Cloud Console OAuth settings. Universities often require apps to be published or verified before they’ll work with .edu domains - it’s a security thing. Switch your OAuth app from testing to production mode, or add your university domain to the authorized domains in the consent screen settings.
This sounds like a Google Workspace domain restriction, not a NextAuth problem. University email systems usually run on Google Workspace for Education, which has stricter security policies than regular Gmail. Your university’s IT department probably blocks third-party apps by default. You’ll need to contact IT support and ask them to whitelist your app’s OAuth client ID in their Google Admin Console. I hit this exact issue building an app for our campus - IT had to manually approve our OAuth credentials before students could log in with their .edu accounts. Took about a week but fixed everything.