Skip to content

v0.2.0#13

Merged
nicknisi merged 1 commit intomainfrom
v0.2.0
Oct 27, 2025
Merged

v0.2.0#13
nicknisi merged 1 commit intomainfrom
v0.2.0

Conversation

@nicknisi
Copy link
Member

Summary

This release adds new callback customization features and fixes critical bugs in session management and development setup.

Changes

✨ Features

  • Add onSuccess and onError hooks to callback route (feat: add onSuccess and onError hooks to callback route #9)
    • Changed handleCallbackRoute from direct handler to factory function accepting options
    • onSuccess hook provides access to full auth data (oauthTokens, authenticationMethod, organizationId, custom state)
    • onError hook enables custom error responses and logging
    • Provides feature parity with Next.js SDK
    • Breaking change: handleCallbackRoute() now requires parentheses (options parameter is optional)

🐛 Bug Fixes

🔧 Maintenance

Migration Guide

If you're using handleCallbackRoute:

Before:

export const Route = createFileRoute('/api/auth/callback')({
  loader: handleCallbackRoute
});

After:

export const Route = createFileRoute('/api/auth/callback')({
  loader: handleCallbackRoute()  // Note the parentheses
});

Or with hooks:

loader: handleCallbackRoute({
  onSuccess: async (data) => {
    console.log('User authenticated:', data.user.email);
  }
})

Testing

  • Updated tests to use correct default cookie name
  • Example app demonstrates new callback hooks

## Summary

This release adds new callback customization features and fixes critical
bugs in session management and development setup.

## Changes

### ✨ Features
- **Add onSuccess and onError hooks to callback route** (#9)
  - Changed `handleCallbackRoute` from direct handler to factory
function accepting options
  - `onSuccess` hook provides access to full auth data (oauthTokens,
authenticationMethod, organizationId, custom state)
  - `onError` hook enables custom error responses and logging
  - Provides feature parity with Next.js SDK
  - **Breaking change**: `handleCallbackRoute()` now requires
parentheses (options parameter is optional)

### 🐛 Bug Fixes
- **Fix signOut to use configured session cookie name** (#8)
  - Fixed hardcoded 'wos_session' cookie name
  - Now dynamically uses configured cookie name via
`getConfig('cookieName')`
  - Resolves auth state confusion after sign-out
  - Fixes #6

### 🔧 Maintenance
- Remove dotenv direct invocation in vite.config (#10)
- Package updates and type fixes

## Migration Guide

If you're using `handleCallbackRoute`:

**Before:**
```typescript
export const Route = createFileRoute('/api/auth/callback')({
  loader: handleCallbackRoute
});
```

**After:**
```typescript
export const Route = createFileRoute('/api/auth/callback')({
  loader: handleCallbackRoute()  // Note the parentheses
});
```

Or with hooks:
```typescript
loader: handleCallbackRoute({
  onSuccess: async (data) => {
    console.log('User authenticated:', data.user.email);
  }
})
```

## Testing
- Updated tests to use correct default cookie name
- Example app demonstrates new callback hooks
@nicknisi nicknisi merged commit 89531fd into main Oct 27, 2025
4 checks passed
@nicknisi nicknisi deleted the v0.2.0 branch October 27, 2025 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

signOut deletes wos_session but default session cookie is wos-session

2 participants