Skip to content
Skills Library
Programming · Testing

auth-testing

/auth-testing

Test OAuth2 token refresh and session expiry locally. Use when working on auth, tokens, SSO, OIDC, or session management features.

Repository
ui ↗
Licence
MIT
Last repository change
27.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
8
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Test OAuth2 token refresh and session expiry locally. Use when working on auth, tokens, SSO, OIDC, or session management features.

Original author description

Test OAuth2 token refresh and session expiry locally. Use when working on auth, tokens, SSO, OIDC, or session management features.

How it works

  1. Quick Start
  2. Configuration Files
  3. Testing Scenarios
  4. Max Session Duration
  5. Key Relationships
  6. Current Default Values
  7. Debugging
  8. Related Files
Original SKILL.md headings · 159 lines, 592 words
SKILL.md preview
---
name: auth-testing
description: Test OAuth2 token refresh and session expiry locally. Use when working on auth, tokens, SSO, OIDC, or session management features.
---

# Auth Testing Skill

Test OAuth2 authentication flows locally using the built-in OIDC server.

## Quick Start

```bash
pnpm dev:with-auth
```

This starts:

- **Vite dev server**: http://localhost:3000
- **UI Server** (Go): http://localhost:8081
- **OIDC Server**: http://localhost:8889
- **Temporal Server**: http://localhost:7233

## Configuration Files

| File                                             | Purpose                                                 |
| ------------------------------------------------ | ------------------------------------------------------- |
| `server/config/with-auth.yaml`                   | UI server auth settings (maxSessionDuration, providers) |
| `utilities/oidc-server/support/configuration.ts` | OIDC server TTLs (token expiry, session duration)       |

## Testing Scenarios

### 1. Token Refresh

Test that tokens refresh automatically before expiry.

**Config**: AccessToken TTL (60s) < maxSessionDuration (2m)

**Steps**:

1. Login at http://localhost:3000
2. Open browser DevTools > Network tab
3. Wait ~60 seconds
4. Observe `/auth/refresh` request that renews tokens

### 2. Session Expiry

Test that sessions expire and force re-login.

**Config**: maxSessionDuration = Session TTL (both 2m)

**Steps**:

1. Login at http://localhost:3000
2. Wait 2 minutes
3. Make any API request (navigate, refresh)
4. Should redirect to OIDC login page

### 3. Unlimited Session

Test long-lived sessions with only token refresh.

**Config changes**:

```yaml
# server/config/with-auth.yaml
auth:
  maxSessionDuration: 0 # Disable session limit
```

```typescript
// utilities/oidc-server/support/configuration.ts
ttl: {
  Session: 60 * 60 * 24,  // 1 day
}
```

## Max Session Duration

The `maxSessionDuration` config enforces a hard limit on how long a user can stay logged in, independent of token expiry.

### How it works

1. **On login**: Server sets `session_start` cookie with current timestamp
2. **On each request**: Server validates session age against `maxSessionDuration`
3. **On expiry**: Server returns 401, UI redirects to SSO login

### Config location

```yaml
# server/config/with-auth.yaml
auth:
  enabled: true
  maxSessionDuration: 2m # Duration string (e.g., 30m, 1h, 24h)
  # Set to 0 or omit to disable
```

### Difference from token expiry

| Mechanism          | Controls                 | Behavior on expiry                 |
| ------------------ | ------------------------ | ---------------------------------- |
| Token TTL          | How often tokens refresh | Silent refresh via `/auth/refresh` |
| maxSessionDuration | Total session lifetime   | Full re-authentication required    |

### Use cases

- **Security compliance**: Force re-auth every N hours regardless of activity
- **Testing**: Set short duration (2m) to quickly test session expiry flow
- **Production**: Set longer duration (8h, 24h) based on security requirements

## Key Relationships

```
AccessToken TTL < maxSessionDuration  → Enables token refresh
Session TTL = maxSessionDuration      → Forces re-auth at OIDC on expiry
RefreshToken TTL > Session TTL        → Allows refresh within session
```

## Current Default Values

| Setting              | Value | Location         |
| -------------------- | ----- | ---------------- |
| Access Token TTL     | 60s   | OIDC config      |
| ID Token TTL         | 60s   | OIDC config      |
| Refresh Token TTL    | 1 day | OIDC config      |
| OIDC Session TTL     | 2m    | OIDC config      |
| Max Session Duration | 2m    | UI server config |

## Debugging

### View auth logs

The Go server logs token validation:

```
[Auth] Setting refresh token cookie (length: X)
[JWT Validation] Token valid, expires at X (time remaining: X)
```

### Check cookies

In browser DevTools > Application > Cookies:

- `user0`, `user1`... - Base64 encoded user data (short-lived)
- `refresh` - HttpOnly refresh token (long-lived)
- `session_start` - Session start timestamp (HttpOnly)

### Test endpoints

```bash
# Get OIDC discovery
curl http://localhost:8889/.well-known/openid-configuration

# Manual token refresh (requires valid refresh cookie)
curl -X GET http://localhost:8081/auth/refresh --cookie "refresh=<token>"
```

## Related Files

- `server/server/route/auth.go` - Auth routes and callbacks
- `server/server/auth/auth.go` - Token validation and session management
- `server/server/config/config.go` - Auth config struct
- `src/lib/utilities/auth-refresh.ts` - Client-side refresh logic

Versions

The database has no other skills named auth-testing.

Database snapshot: 13.11.2026 · package version 9d4d29703b52 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100configuring-better-auth
    Implement OAuth 2.1 / OIDC authentication using Better Auth with MCP assistance. Use when setting up a centralized auth server (SSO provider), implementing SSO clients in Next.js apps, configuring PKCE flows, or managing tokens with JWKS verification. Uses Better Auth MCP for…
  • 100agent-auth-specialist
    Specialist subagent: OAuth 2.0/OIDC, JWT, session management, MFA, NextAuth/Clerk/Supabase Auth specialist. Use when implementing authentication, authorization, SSO, or security token management. Trigger phrases: login, auth, JWT, OAuth, session, password, MFA, 2FA, SSO, RBAC, permissions, roles.
  • 100better-auth
    Use when implementing Next.js authentication with Better Auth — OAuth, 2FA, magic links, SSO, Stripe billing, or session management.
  • 100saas-sso-scim-enterprise-auth
    Use when implementing tenant-scoped SAML or OIDC SSO, SCIM provisioning, custom domains, IP allowlists, or enterprise auth migration.
  • 100formio-auth
    Form.io authentication and authorization specialist — resource-backed login (Login plus Role Assignment Actions), role-based access control and group permissions, SSO via OIDC/OAuth/SAML/LDAP with provider role mapping, Token Swap, Custom JWT for Enterprise/on-prem, email-token…
  • 100ssojet
    Use when adding, fixing, or improving how an app signs users in with SSO or OIDC, protects a backend with machine-to-machine tokens, or manages teams, tenants, roles, invitations, and directory sync (SCIM) — or when using or configuring any SSOJet feature or API. Covers Next.js,…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.