Overview
OpenLIT supports these sign-in methods:- Google - Sign in with Google accounts
- GitHub - Sign in with GitHub accounts
- Microsoft - Sign in with Microsoft Entra ID (work, school, or personal Microsoft accounts)
- Okta - Sign in through your Okta organisation
- Email/Password - Traditional credentials-based authentication
https://openlit.example.com/api/auth/callback/okta.
NextAuth.js automatically handles:
- OAuth 2.0 authorization flow
- Token management and refresh
- User session management
- Security best practices
- Creates new user accounts if they don’t exist
- Links the provider to an existing account with the same email, when the provider has verified that email (see Account linking)
- Syncs profile information (name, profile picture)
- Runs user setup and database configuration
Google OAuth setup
1. Create Google Cloud project
Access Google API console
Create or select project
- Click on the project dropdown at the top
- Click “New Project” or select an existing project
- Give your project a meaningful name like “OpenLIT Authentication”
Enable required APIs
- Navigate to “APIs & Services” > “Library”
- Search for and enable “Google+ API” or “People API”
- This allows access to user profile information
2. Configure OAuth consent screen
Setup consent screen
- Navigate to “APIs & Services” > “OAuth consent screen”
- Choose “External” for user type (unless you have Google Workspace)
- Fill in required information:
- App name: OpenLIT
- User support email: Your email address
- Developer contact information: Your email address
Add test users (Development)
- For testing, add email addresses that can access your app
- Production apps will be available to all users once published
3. Create OAuth credentials
Create Web Application Credentials
- Navigate to “APIs & Services” > “Credentials”
- Click “Create Credentials” > “OAuth client ID”
- Select “Web application”
Configure redirect URIs
- Authorized JavaScript origins:
- Authorized redirect URIs:
Save credentials
- Click “Create”
- Copy the Client ID and Client Secret
- Store them securely for environment configuration
GitHub OAuth setup
1. Create GitHub OAuth app
Access GitHub Developer Settings
Register New OAuth Application
- Application name: OpenLIT
- Homepage URL:
http://localhost:3000(development) orhttps://yourdomain.com(production) - Authorization callback URL:
Generate Client Secret
- Click “Register application”
- Copy the Client ID
- Click “Generate a new client secret”
- Copy the Client Secret immediately (it won’t be shown again)
2. GitHub app permissions (Optional)
Microsoft setup
Register an application
- Name: OpenLIT
- Supported account types: choose Accounts in this organizational directory only to limit sign-in to your organisation, or a multi-tenant option to accept other directories
- Redirect URI: select Web and enter
https://yourdomain.com/api/auth/callback/azure-ad(usehttp://localhost:3000/api/auth/callback/azure-adfor local development)
Copy the IDs
AZURE_AD_CLIENT_ID, and the Directory (tenant) ID for AZURE_AD_TENANT_ID.Create a client secret
AZURE_AD_CLIENT_SECRET. It’s shown only once.Choose the tenant
- Set
AZURE_AD_TENANT_IDto your directory ID or a verified domain to accept only your organisation. This is recommended. - Leave it unset (or set
common) to accept any Microsoft account.organizationsaccepts any work or school account, andconsumersaccepts only personal Microsoft accounts.
Okta setup
Create an app integration
Configure the redirect URI
- Sign-in redirect URIs:
https://yourdomain.com/api/auth/callback/okta(usehttp://localhost:3000/api/auth/callback/oktafor local development) - Assignments: assign the users or groups who should be able to sign in to OpenLIT
Copy the credentials
OKTA_CLIENT_ID and the Client secret for OKTA_CLIENT_SECRET. Keep Client authentication set to Client secret.Find the issuer
https://your-domain.okta.com/oauth2/default. Set it as OKTA_ISSUER. The issuer must be a public https URL.Environment Configuration
Production Setup
Update OAuth app URLs
- Google: Add
https://yourdomain.comto origins andhttps://yourdomain.com/api/auth/callback/googleto redirect URIs - GitHub: Update callback URL to
https://yourdomain.com/api/auth/callback/github - Microsoft: Add
https://yourdomain.com/api/auth/callback/azure-adas a Web redirect URI - Okta: Add
https://yourdomain.com/api/auth/callback/oktaas a sign-in redirect URI
HTTPS requirement
Features & behavior
User management
- New Users: Automatically created when signing in with a provider for the first time
- Existing Users: A provider is linked to an existing account with the same email when the provider has verified the email (see below)
- Profile Sync: Name and profile picture are synced from the provider when the account doesn’t have them yet
- Database Setup: New users get proper database configurations and permissions
Account linking
When someone signs in with a provider and an OpenLIT account already uses that email, OpenLIT links the provider to that account only when the provider vouches for the email:Session management
NextAuth.js handles all session management including:- JWT token creation and validation
- Session persistence across browser sessions
- Automatic token refresh when needed
- Secure cookie configuration
Troubleshooting
Redirect URI mismatch error
Redirect URI mismatch error
- Verify redirect URIs match exactly in OAuth app settings
- Check port numbers (3001 vs 3000)
- Ensure protocol matches (http/https)
Invalid client error
Invalid client error
- In OpenLIT Enterprise, use Test credentials on Instance admin → Auth to check the values with the provider
- For Microsoft, use the client secret Value, not the secret ID, and check that the secret hasn’t expired
- Verify client credentials are copied correctly
- Check for extra spaces or characters in environment variables
- Ensure you’re using credentials from the correct OAuth app
Sign-in refused for an existing account
Sign-in refused for an existing account
- The provider didn’t verify the email, so OpenLIT won’t link it to the existing account. See Account linking
- For Microsoft, set
AZURE_AD_TENANT_IDto your directory instead ofcommon - Sign in with the method the account used originally (for example, email and password)
Okta issuer rejected
Okta issuer rejected
- Use the full issuer URI from Security > API > Authorization Servers, such as
https://your-domain.okta.com/oauth2/default - The issuer must use
httpsand a public hostname. IP addresses,localhost, and private network addresses are rejected
NEXTAUTH_URL mismatch
NEXTAUTH_URL mismatch
- Set
NEXTAUTH_URL=http://localhost:3000for development - Set
NEXTAUTH_URL=https://yourdomain.comfor production - Ensure the URL matches your actual application URL

