CampusConnections

Admin Login Flow Test

Test the complete authentication flow for administrators

Environment Variables Check
Required variables for admin login to work
MAIL_FROM
Required
SENDGRID_API_KEY
Required
EMAIL_TOKEN_SECRET
Required
APP_BASE_URL
Required
Test Admin Login
Enter an admin email address to test the complete login flow
Manual Testing Steps
  1. Create Admin User

    Go to Admin Dashboard → Users & Access → Click "Invite Admin"

  2. Accept Invitation

    Check email inbox → Click activation link → Account created

  3. Sign In

    Go to /SignIn → Enter admin email → Click "Send Sign-In Link"

  4. Check Email

    Open email → Click magic link (expires in 15 min)

  5. Verify Login

    Should redirect to /admin automatically

Common Issues & Solutions

❌ Email not received

  • • Check spam/junk folder
  • • Verify SENDGRID_API_KEY and MAIL_FROM are set
  • • Make sure sender email is verified in SendGrid
  • • Check SendGrid dashboard for delivery logs

❌ Link expired

  • • Magic links expire in 15 minutes
  • • Request a new link from /SignIn page

❌ "Invalid token" error

  • • Check EMAIL_TOKEN_SECRET is set in environment
  • • Make sure token hasn't been used already
  • • Verify token hasn't expired