Supported authentication methods
Username and password
Built-in credential-based login. Suitable for smaller deployments where you manage users directly in Karma LMS.
SSO (SAML / OAuth 2.0)
Delegate authentication to an external identity provider such as Okta, Azure AD, Google Workspace, or any SAML 2.0 / OAuth 2.0 compliant IdP.
Token-based (JWT)
Issue and validate JSON Web Tokens for API access and headless or embedded LMS integrations.
Configuring authentication
Set authDomain in environment.ts
Open For production, update
src/environments/environment.ts and set authDomain to your identity provider’s domain:src/environments/environment.ts
environment.prod.ts with your production IdP domain.Configure your identity provider
Register Karma LMS as an application in your identity provider. The required values depend on your auth method:
- OAuth 2.0 / OIDC
- SAML 2.0
- Username / password
Configure the following in your OAuth provider:
| Setting | Value |
|---|---|
| Allowed callback URL | https://yourdomain.com/auth/callback |
| Allowed logout URL | https://yourdomain.com/logout |
| Allowed web origins | https://yourdomain.com |
| Grant type | Authorization Code with PKCE |
src/app/auth/auth.config.ts
Role-based access control
Karma LMS enforces access at the route and API level based on the authenticated user’s role.| Feature | Admin | Instructor | Learner |
|---|---|---|---|
| Manage users and roles | Yes | No | No |
| Create and publish courses | Yes | Yes | No |
| Edit their own courses | Yes | Yes | No |
| View all learner progress | Yes | Yes | No |
| Enroll learners in courses | Yes | Yes | No |
| Access assigned courses | Yes | Yes | Yes |
| Complete lessons and quizzes | Yes | Yes | Yes |
| View personal progress report | Yes | Yes | Yes |
| Access admin dashboard | Yes | No | No |
| Manage system settings | Yes | No | No |
AuthGuard, RoleGuard) enforce these permissions on the frontend. Backend API endpoints perform a secondary role check on every request.
Session management
Token expiry
Karma LMS uses short-lived access tokens combined with longer-lived refresh tokens. Default durations:| Token | Default expiry |
|---|---|
| Access token | 60 minutes |
| Refresh token | 7 days |
| Remember me (refresh token) | 30 days |
Refresh token rotation
Karma LMS rotates refresh tokens on each use. If a previously issued refresh token is presented (indicating a possible token theft), the session is immediately invalidated and the user is signed out.src/app/auth/token-interceptor.ts
All Karma LMS API endpoints require a valid bearer token. Requests without a token, or with an expired token that cannot be refreshed, receive a
401 Unauthorized response and the user is redirected to the login page.Frequently asked questions
How do I reset a user's password?
How do I reset a user's password?
Username/password auth: An admin can trigger a password reset from the admin panel under Users → Select user → Reset password. This sends a reset link to the user’s registered email address.SSO auth: Password resets are handled entirely by your identity provider. Direct the user to your IdP’s self-service portal (e.g., the Okta or Azure AD end-user dashboard). Karma LMS does not manage IdP credentials.If the reset email is not received, check that the Karma LMS backend has a valid SMTP configuration and that the user’s email address is correct.
How do I configure SSO?
How do I configure SSO?
Follow the steps in the Configuring authentication section above. In summary:
- Set
authDomaininenvironment.tsto your IdP domain. - Register Karma LMS as an OAuth 2.0 / OIDC or SAML 2.0 application in your IdP.
- Supply the callback and logout URLs from the table above.
- Configure role mappings so IdP groups map to Karma LMS roles.
- Rebuild and deploy:
ng build --configuration production.
How do I revoke a user's access?
How do I revoke a user's access?
Immediate revocation: Deactivate or delete the user in the Karma LMS admin panel under Users → Select user → Deactivate. Active sessions using a valid access token will continue to work until the token expires (up to 60 minutes). Refresh tokens for deactivated users are rejected immediately.SSO users: You must also revoke the session in your identity provider. Karma LMS relies on the IdP for authentication; revoking only in Karma LMS prevents new logins but does not terminate an existing IdP session.Force sign-out: To immediately terminate all sessions for a user, revoke their refresh tokens from the admin panel under Users → Select user → Revoke all sessions.
