---
title: "Authenticates with google (Roles: user, none)"
method: POST
path: "/auth/google"
tags: ["Authentication"]
---

# Authenticates with google (Roles: user, none)

`POST /auth/google`

## Query parameters

- `register` boolean

## Request body

- StringValue
  - `value` string
  - `value2` string

## Response `200`

Success

- LoginPayload
  - `token` string
  - `user` User
    - `_id` string, required
    - `name` string
    - `first_name` string
    - `last_name` string
    - `teams` string[]
    - `email` string, required
    - `stripped_email` string
    - `password` string
    - `role` 'user', required
    - `stripe_id` string
    - `selected_project` string
    - `number_generations` integer
    - `registration_date` integer
    - `whats_new_date` integer
    - `trial_end` integer
    - `tax` Tax
      - `value` string
      - `type` string
    - `address` Address
      - `line1` string
      - `line2` string
      - `city` string
      - `postal_code` string
      - `state` string
      - `country` string
    - `tutorials_closed` string[]
    - `missions_completed` string[]
    - `credits` GenerationCreditsInfo
      - `current` number, float
      - `max` number, float
      - `reset_date` integer
      - `extra` number, float
      - `total` number, float
      - `paused` boolean
      - `has_tier_logic` boolean
      - `uses_team_credits` boolean
      - `credits_upfront` boolean
      - `grace_until` integer — If set, the user's subscription ended and their remaining credits stay spendable until this unix timestamp (30-day grace period)
      - `grace_reason` string — Stripe cancellation_details.reason at termination (e.g. cancellation_requested, payment_failed)
    - `auto_topup` AutoTopupSettings
      - `enabled` boolean
      - `threshold` number, float — When available credits (max + extra - current) drop below this, an automatic top-up is attempted
      - `credits` integer — Fixed credit amount to buy on each automatic top-up (TOPUP bracket pricing)
      - `armed` boolean — Hysteresis latch: true while the balance is above the threshold; consumed (set false) by the single attempt per below-threshold episode
    - `country` string
    - `genres` string[]
    - `platform` string
    - `welcome_form` boolean
    - `paywall` boolean
    - `video_generator` boolean
    - `subscription_stats` SubscriptionStats
      - `revenue_year` number, float
      - `revenue_12months` number, float
      - `revenue_total` number, float
      - `plan_name` string
      - `plan_interval` string
      - `is_customer` boolean
      - `became_customer_date` integer
    - `date_whats_new` integer
    - `api_key` string
    - `cookie_consent` boolean
    - `double_optin_sent` boolean
    - `credits_exhausted_at` integer
    - `credits_exhausted_synced_at` integer
    - `risk_hold` boolean
    - `marketing_consent` MarketingConsent
      - `granted` boolean
      - `date` integer
      - `source` string
    - `fbp` string
    - `fbc` string
    - `fbclid` string
    - `rdt_cid` string
    - `last_login_ip` string — IP address of last login
    - `purchase_ips` PurchaseIp[] — Capped history of client IPs captured at purchase actions (subscribe, checkout, card/payment confirmation, renewal). Used as chargeback evidence to tie a disputed transaction to the rightful cardholder.
      - `ip` string
      - `date` integer — Unix epoch seconds when this IP was captured at a purchase action
    - `preferred_content_type` string
    - `questionnaire` Questionnaire
      - `date` integer
      - `questions` Question[]
        - `question` string
        - `answer` string
    - `rate_limits_override` integer
    - `referral_code` string
    - `referred_by` string — User ID of the referrer
    - `referral_credited` boolean — Whether referral bonus credits have been issued for this user
    - `subscriber_welcome_sent_at` integer
    - `referral_announce_sent_at` integer
    - `discord_link_id` string — Opaque uuid shown on the user's Discord profile as their Ludo connection. Rotatable. Never the user id.
    - `discord_user_id` string — Discord snowflake of the linked account.
    - `discord_linked_at` string, date-time — When the Discord account was last linked.
    - `totp` UserTotp
      - `secret_enc` string — TOTP shared secret, encrypted at rest (encryptionUtils.encryptSecret).
      - `confirmed` boolean — True once the user proved possession of the secret with a code. An unconfirmed enrolment does not count as 2FA being enabled.
      - `last_timestep` integer — Timestep of the last accepted code. Anti-replay: a code whose timestep is not greater than this is rejected.
      - `created_at` string, date-time
    - `webauthn_credentials` UserWebauthnCredential[] — Registered passkeys (WebAuthn credentials) for this user.
      - `credential_id` string — base64url credential id returned by the authenticator.
      - `public_key` string — base64url COSE public key used to verify assertions.
      - `counter` integer — Signature counter of the last accepted assertion (clone detection).
      - `transports` string[]
      - `name` string — User-visible label for the passkey.
      - `created_at` string, date-time
      - `last_used_at` string, date-time
    - `recovery_codes` UserRecoveryCode[] — Single-use 2FA recovery codes, stored hashed. Regenerating replaces the whole array.
      - `hash` string — bcrypt hash of the recovery code; the plaintext is shown once.
      - `used_at` string, date-time — When the code was redeemed. Unset while the code is still usable.
    - `sessions_version` integer — Bumped whenever every existing session must be invalidated (2FA enable/disable, password change). Tokens carry it as the `sv` claim and are rejected when it no longer matches.
  - `subscription` Subscription
    - `id` string
    - `object` string
    - `collection_method` string
    - `cancel_at_period_end` boolean
    - `canceled_at` integer
    - `cancel_at` integer
    - `created` integer
    - `current_period_end` integer
    - `current_period_start` integer
    - `customer` string
    - `days_until_due` integer
    - `ended_at` integer
    - `plan` PaymentPlan
      - `id` string, required
      - `object` string
      - `description` string
      - `amount` integer
      - `statement_descriptor` string
      - `trial_period_days` integer
      - `created` integer
      - `currency` string
      - `interval` string
      - `interval_count` integer
      - `livemode` boolean
      - `active` boolean
      - `billing_scheme` string
      - `product` string
      - `name` string
      - `usage_type` string
      - `nickname` string
      - `amount_off` integer
      - `percent_off` integer
      - `metadata` PaymentPlanMetadata
        - `projects` string
        - `description` string
        - `seats` string
        - `favorites` string
        - `team` string
        - `amount_text` string
        - `credits` string
        - `premium` string
        - `magic_link` string
        - `api` string
        - `rate_limits` string
    - `quantity` integer
    - `start_date` integer
    - `status` string
    - `tax_percent` integer
    - `trial_end` integer
    - `trial_start` integer
    - `billing_cycle_anchor` integer
    - `latest_invoice` string
    - `from_team` boolean
    - `pause_collection` SubscriptionPauseCollection
      - `behavior` string
      - `resumes_at` integer
    - `resume_requires_payment` boolean — Present (true) only while the subscription is paused and at least one billing cycle was skipped (voided) during the pause, meaning a resume will immediately charge the full plan price for a fresh cycle.
  - `registered` boolean
  - `magic_link_sent` boolean
  - `magic_link_message` string
  - `two_factor_required` boolean — Credentials were accepted but the account has 2FA enabled, so no token is issued. Exchange the challenge_ticket for a full payload via /auth/2fa/verify.
  - `challenge_ticket` string — Single-use, short-lived ticket identifying the pending 2FA challenge.
  - `two_factor_methods` string[] — Second factors the user can present for this challenge.

## Other responses

- `400` — Error

---

[API](https://skmtc.dev/ludo/apis/ludo-ai-api.md) · [All operations](https://skmtc.dev/ludo/apis/ludo-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ludo/ludo-ai-api/revisions/37a21589e770/schema)
