TopRank Skills

Home / Claw Skills / DevOps / Twenty Oauth Mastery
Official OpenClaw rules 36%

Twenty Oauth Mastery

Twenty CRM OAuth Mastery Skill

Stars

0

Installs

0

Status

ACTIVE

Visibility

PUBLIC

安装方式

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 Twenty Oauth Mastery 技能。 若已安装,则直接安装 Twenty Oauth Mastery 技能。

Overview

Skill Key
avirweb/twenty-oauth-mastery
Author
avirweb
Source Repo
openclaw/skills
Version
-
Source Path
skills/avirweb/twenty-oauth-mastery
Latest Commit SHA
0144e01f496c6afdd6ebe564eab1cae72e14be1c

Extracted Content

SKILL.md excerpt

# Twenty CRM OAuth Mastery Skill

**Author**: Generated from extensive OAuth debugging sessions in OpenCode  
**Last Updated**: 2026-02-08  
**Version**: 1.0

---

## Skill Metadata

```yaml
name: twenty-oauth-mastery
description: Expert-level OAuth authentication knowledge for Twenty CRM including implementation, troubleshooting, and best practices
expertise_level: Expert/Mastery
category: Authentication
applicable_to:
  - Twenty CRM authentication
  - Google/Microsoft OAuth
  - Token refresh management
  - Domain restrictions
  - Email/Calendar sync integration
prerequisites:
  - Knowledge of TypeScript/JavaScript
  - Understanding of OAuth 2.0 protocol
  - Familiarity with NestJS framework
keywords:
  - oauth
  - authentication
  - twenty-crm
  - google-oauth
  - microsoft-oauth
  - token-refresh
  - sync-integration
  - domain-restriction
```

---

## Quick Start

### When to Use This Skill

You should use this skill when working on:

✅ **Implementing** new OAuth providers  
✅ **Fixing** OAuth login issues  
✅ **Setting up** automatic Gmail/Calendar sync after OAuth  
✅ **Debugging** token refresh failures  
✅ **Configuring** domain restrictions  
✅ **Troubleshooting** redirect loops  

### Quick Reference for Common Issues

| Issue | File to Check | Quick Fix |
|-------|---------------|-----------|
| Redirect loop | `auth.service.ts` | Rebuild: `npx nx build twenty-server` |
| .co domain blocked | `google-auth.controller.ts` | Add to allowlist: `['company.com', 'company.co']` |
| Sync not starting | `google.auth.strategy.ts` | Return tokens in validate() |
| Cookie not readable | Controller cookie settings | Set `httpOnly: false` |
| Infinite loop | `SignInUpGlobalScopeFormEffect.tsx` | Track processed token signatures |

---

## Core Knowledge

### 1. Twenty CRM OAuth Architecture

**Key Files**: `twenty/packages/twenty-server/src/engine/core-modules/auth/`

**Structure**:
```
auth/
├── strategies/         # Passport strategies (Google, Microsoft)
├── co...

README excerpt

# Twenty CRM OAuth Mastery Skill - Created

## What Was Created

A comprehensive expertise skill for Twenty CRM OAuth integration, troubleshooting, and best practices based on extensive session analysis.

## Skill Location

**Primary File**: `/home/agent/fratres/custom-skills/twenty-oauth-mastery.skill.md`

**Draft Documentation**: `/home/agent/fratres/.sisyphus/drafts/twenty-oauth-mastery-skill.md`

## Skill Overview

**Name**: `twenty-oauth-mastery`

**Expertise Level**: Expert/Mastery

**Applicable To**:
- Twenty CRM authentication
- Google/Microsoft OAuth
- Token refresh management
- Domain restrictions
- Email/Calendar sync integration

---

## Key Components

### 1. Architecture Knowledge

**File Structure**: `twenty/packages/twenty-server/src/engine/core-modules/auth/`

```
auth/
├── strategies/         # Passport strategies (Google, Microsoft)
├── controllers/        # OAuth endpoints and callbacks
├── services/          # Auth logic, sync setup, token management
├── guards/            # Auth guards and validation
└── utils/             # Scope configuration, utilities
```

### 2. 5 Major Issues with Solutions

| Issue | Quick Fix |
|-------|-----------|
| **Redirect Loop** | Rebuild: `npx nx build twenty-server` |
| **.co Domain Blocked** | Add to allowlist in 3 places |
| **Sync Not Starting** | Return tokens in validate() method |
| **Cookie Not Readable** | Set `httpOnly: false` |
| **Infinite Loop** | Track processed token signatures |

### 3. Critical Code Patterns

**Passport Strategy** (MUST FOLLOW):
```typescript
passReqToCallback: true, // Required
return { ..., accessToken, refreshToken }; // Must preserve tokens
```

**Token Refresh**:
```typescript
// Preserve original refresh token (Google may not return new one)
return { accessToken: token, refreshToken: refreshToken };
```

### 4. Testing Strategies

- Unit testing for token refresh
- Playwright for cookie injection testing
- Database verification for sync issues

### 5. Deployment Checklist...

Related Claw Skills