{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/granite-md/json-schema/granite-md-social-login-request-schema.json",
  "title": "SocialLoginRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/granite-md-openapi.yaml#/components/schemas/SocialLoginRequest",
  "type": "object",
  "required": [
    "id_token",
    "nonce",
    "device"
  ],
  "properties": {
    "id_token": {
      "type": "string",
      "maxLength": 8000
    },
    "nonce": {
      "type": "string",
      "minLength": 16,
      "maxLength": 200
    },
    "name": {
      "type": "string",
      "maxLength": 200,
      "description": "Apple gives the user's name to the app only on the first sign-in."
    },
    "authorization_code": {
      "type": "string",
      "maxLength": 2000,
      "description": "Apple only: the authorization code Apple returned with the ID token. The server\nexchanges it for a refresh token, kept encrypted, so that deleting the account can\nrevoke Granite's access to the person's Apple ID (App Store Review Guideline 5.1.1(v)).\nA failed exchange does not stop the sign-in.\n"
    },
    "workspace_name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "description": "Signs up for a business account (with a company's Google Workspace account, say): when\nthis sign-in creates the account, it also gets a workspace of this name, owned by it,\non the 30-day Business trial. Ignored for an existing account.\n"
    },
    "device": {
      "$ref": "#/$defs/DeviceInfo"
    }
  },
  "$defs": {
    "DeviceInfo": {
      "type": "object",
      "required": [
        "platform"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Device ID from an earlier sign-in, to keep the same device record."
        },
        "name": {
          "type": "string",
          "maxLength": 100
        },
        "platform": {
          "type": "string",
          "enum": [
            "web",
            "macos",
            "windows",
            "ios",
            "android",
            "cli",
            "other"
          ]
        },
        "app_version": {
          "type": "string",
          "maxLength": 50
        }
      }
    }
  }
}