Sonarly Claude Code 7fc32d8493 fix: add validation and default for AUTH_GOOGLE_APIS_CALLBACK_URL config variable
https://sonarly.com/issue/26553?type=bug

Self-hosted users configuring `AUTH_GOOGLE_APIS_CALLBACK_URL` with an incorrect path (e.g., `/auth/google/apis/callback` instead of `/auth/google-apis/get-access-token`) get a 404 page after Google OAuth consent because no NestJS route handles the misconfigured path, and the config variable lacks validation unlike its peer variables.

Fix: Two changes that work together to prevent the misconfiguration that caused this issue:

**1. `config-variables.ts` — Add validation decorators to `AUTH_GOOGLE_APIS_CALLBACK_URL`**

Added `@IsUrl({ require_tld: false, require_protocol: true })` and `@IsOptional()` to match the validation pattern used by peer variables (`AUTH_GOOGLE_CALLBACK_URL`, `AUTH_MICROSOFT_CALLBACK_URL`, `AUTH_MICROSOFT_APIS_CALLBACK_URL`). This catches malformed URLs at startup when the variable is explicitly set, while `@IsOptional()` allows omitting it entirely (so the fallback can work).

**2. `google-apis-oauth-common.auth.strategy.ts` — Add SERVER_URL fallback**

When `AUTH_GOOGLE_APIS_CALLBACK_URL` is not set, the strategy now auto-computes the correct callback URL from `SERVER_URL` (which defaults to `http://localhost:3000`). The fallback path `/auth/google-apis/get-access-token` matches the NestJS controller route exactly. This eliminates the most common misconfiguration scenario — users who set `SERVER_URL` correctly no longer need to also set `AUTH_GOOGLE_APIS_CALLBACK_URL`.

Together these changes:
- **Prevent invalid URLs**: `@IsUrl` catches malformed URLs at server startup
- **Eliminate the need for manual configuration**: The fallback auto-computes from `SERVER_URL`
- **Maintain backward compatibility**: Existing deployments with `AUTH_GOOGLE_APIS_CALLBACK_URL` set correctly continue to work unchanged
2026-04-15 11:02:08 +00:00
2026-04-11 10:00:24 +00:00

Twenty logo

The #1 Open-Source CRM

🌐 Website · 📚 Documentation · Roadmap · Discord · Figma


Cover


Installation

See: 🚀 Self-hosting 🖥️ Local Setup

Why Twenty

We built Twenty for three reasons:

CRMs are too expensive, and users are trapped. Companies use locked-in customer data to hike prices. It shouldn't be that way.

A fresh start is required to build a better experience. We can learn from past mistakes and craft a cohesive experience inspired by new UX patterns from tools like Notion, Airtable or Linear.

We believe in open-source and community. Hundreds of developers are already building Twenty together. Once we have plugin capabilities, a whole ecosystem will grow around it.


What You Can Do With Twenty

Please feel free to flag any specific needs you have by creating an issue.

Below are a few features we have implemented to date:

Personalize layouts with filters, sort, group by, kanban and table views

Companies Kanban Views

Customize your objects and fields

Setting Custom Objects

Create and manage permissions with custom roles

Permissions

Automate workflow with triggers and actions

Workflows

Emails, calendar events, files, and more

Other Features


Stack

Thanks

Chromatic Greptile Sentry Crowdin E2B

Thanks to these amazing services that we use and recommend for UI testing (Chromatic), code review (Greptile), catching bugs (Sentry) and translating (Crowdin).

Join the Community

Languages
TypeScript 78%
MDX 18.5%
JavaScript 3.1%
Python 0.2%