# ai.newnal.illi.account.parent.startOAuth

> Start a parent's OAuth sign-in on the device through the PDN's own page (BFF), for an existing Newnal ID whose credentials are typed on the PDN page. Device-created accounts, and existing ones whose credentials the device app takes itself, sign in with account.parent.signIn instead. client=native ends with a one-time code on the device app's App Link for account.exchangeCode instead of a cookie.

- Kind: procedure
- Authority: parent.account.illi.newnal.ai
- Lexicon: 1
- Published by [illi-service.newnal.id](https://lexicon.garden/identity/did:plc:uztm7bi2ce42dez3uu3qafro), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:uztm7bi2ce42dez3uu3qafro/ai.newnal.illi.account.parent.startOAuth)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:uztm7bi2ce42dez3uu3qafro/ai.newnal.illi.account.parent.startOAuth/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:uztm7bi2ce42dez3uu3qafro/ai.newnal.illi.account.parent.startOAuth/analytics)

## Procedure (`ai.newnal.illi.account.parent.startOAuth`)

Type: procedure · POST

### Input (application/json)

- `client` (string): web (default): the callback sets the device-app cookie. native: the callback redirects to the device app's App Link with a 60-second one-time code for account.exchangeCode.
  - Constraints: default: "web", knownValues: web | native
- `codeChallenge` (string): Required with client native: base64url(SHA-256(codeVerifier)) without padding. The one-time code the callback returns can only be exchanged with that verifier (account.exchangeCode).
  - Constraints: minLength: 43, maxLength: 43
- `deviceId` (string)
  - Constraints: maxLength: 64
- `mode` (string, required)
  - Constraints: knownValues: create | signIn
- `slot` (integer)
  - Constraints: minimum: 1, maximum: 2

### Output (application/json)

- `loginUrl` (string · uri, required)

### Errors

- `ParentLimitReached`: No description in schema.
- `ParentAlreadyLinked`: No description in schema.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Start a parent's OAuth sign-in on the device through the PDN's own page (BFF), for an existing Newnal ID whose credentials are typed on the PDN page. Device-created accounts, and existing ones whose credentials the device app takes itself, sign in with account.parent.signIn instead. client=native ends with a one-time code on the device app's App Link for account.exchangeCode instead of a cookie.",
      "errors": [
        {
          "name": "ParentLimitReached"
        },
        {
          "name": "ParentAlreadyLinked"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "client": {
              "default": "web",
              "description": "web (default): the callback sets the device-app cookie. native: the callback redirects to the device app's App Link with a 60-second one-time code for account.exchangeCode.",
              "knownValues": [
                "web",
                "native"
              ],
              "type": "string"
            },
            "codeChallenge": {
              "description": "Required with client native: base64url(SHA-256(codeVerifier)) without padding. The one-time code the callback returns can only be exchanged with that verifier (account.exchangeCode).",
              "maxLength": 43,
              "minLength": 43,
              "type": "string"
            },
            "deviceId": {
              "maxLength": 64,
              "type": "string"
            },
            "mode": {
              "knownValues": [
                "create",
                "signIn"
              ],
              "type": "string"
            },
            "slot": {
              "maximum": 2,
              "minimum": 1,
              "type": "integer"
            }
          },
          "required": [
            "mode"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "loginUrl": {
              "format": "uri",
              "type": "string"
            }
          },
          "required": [
            "loginUrl"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "ai.newnal.illi.account.parent.startOAuth",
  "lexicon": 1
}
```
