add Embedded Wallet OAUTH credential create#360
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
✱ Stainless preview buildsThis PR will update the kotlin openapi python typescript Edit this comment to update them. They will appear in their respective SDK's changelogs. ✅ grid-openapi studio · code · diff
✅ grid-typescript studio · code · diff
✅ grid-python studio · code · diff
✅ grid-kotlin studio · code · diff
This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
ca6461a to
ed7f4ba
Compare
0cf8aa3 to
76dc700
Compare
Greptile SummaryThis PR extends
Confidence Score: 4/5Safe to merge if the 202 OAUTH challenge schema gap is addressed before the feature goes live, since it will cause SDK and consumer issues for accounts with multiple OAUTH credentials. One P1 finding: AuthCredentialAdditionalChallengeOneOf lacks an OAUTH variant, leaving the 202 response for OAUTH-only accounts unschematised. The P2 verify-endpoint note is acknowledged in the PR description as intentional staging. All schema structure is otherwise correct and consistent with existing patterns. openapi/paths/auth/auth_credentials.yaml and openapi/components/schemas/auth/AuthCredentialAdditionalChallengeOneOf.yaml need attention for the missing OAUTH 202 challenge variant.
|
| Filename | Overview |
|---|---|
| openapi/components/schemas/auth/OauthCredentialCreateRequestFields.yaml | New fields schema for OAUTH variant; mirrors EMAIL_OTP pattern with a single-value type enum and oidcToken string. Well-documented with description covering iss/.well-known validation and iat window. |
| openapi/components/schemas/auth/OauthCredentialCreateRequest.yaml | Correctly composed as allOf(AuthCredentialCreateRequest, OauthCredentialCreateRequestFields), matching the EMAIL_OTP pattern exactly. |
| openapi/components/schemas/auth/AuthCredentialCreateRequestOneOf.yaml | OAUTH correctly added to oneOf list and discriminator mapping. |
| openapi/paths/auth/auth_credentials.yaml | OAUTH create example added correctly; description updated with inline validation note. Missing: 202 challenge schema/example for the OAUTH-as-existing-credential case (P1), and verify endpoint not yet updated (P2). |
| .stainless/stainless.yml | Two new schema entries registered for SDK generation; consistent with existing pattern. |
Sequence Diagram
sequenceDiagram
participant Platform
participant GridAPI
participant OIDC_Provider as OIDC Provider
Note over Platform,GridAPI: First OAUTH credential on account
Platform->>GridAPI: POST /auth/credentials {type: OAUTH, accountId, oidcToken}
GridAPI->>OIDC_Provider: Fetch /.well-known/openid-configuration
OIDC_Provider-->>GridAPI: Public signing keys
GridAPI->>GridAPI: Verify token signature and iat 60s window
GridAPI-->>Platform: 201 AuthMethod
Note over Platform,GridAPI: Second OAUTH credential (additional)
Platform->>GridAPI: POST /auth/credentials {type: OAUTH, accountId, oidcToken}
GridAPI-->>Platform: 202 payloadToSign + requestId (OAUTH challenge unschematised)
Platform->>Platform: Sign payload with existing credential session key
Platform->>GridAPI: POST /auth/credentials retry + Grid-Wallet-Signature header
GridAPI-->>Platform: 201 AuthMethod
Note over Platform,GridAPI: Activation - next PR
Platform->>GridAPI: POST /auth/credentials/{id}/verify (OAUTH branch not yet added)
Comments Outside Diff (1)
-
openapi/paths/auth/auth_credentials.yaml, line 95-115 (link)Missing OAUTH 202 challenge variant
The PR description states "multiple OAuth credentials are allowed per internal account." When an account already has a verified OAUTH credential and a caller registers a second one, the server will return a
202whose discriminatedtypewill beOAUTH. However,AuthCredentialAdditionalChallengeOneOf.yamlonly mapsEMAIL_OTP, so the202response body for that case is both unschematised and undocumented here. SDK generators and API consumers reading this spec won't know how to deserialise that response. A siblingOauthCredentialAdditionalChallengeschema (and mapping entry) should be added alongside this PR, or at minimum the next PR in the stack should be called out explicitly so the omission is tracked.Prompt To Fix With AI
This is a comment left during a code review. Path: openapi/paths/auth/auth_credentials.yaml Line: 95-115 Comment: **Missing OAUTH 202 challenge variant** The PR description states "multiple OAuth credentials are allowed per internal account." When an account already has a verified OAUTH credential and a caller registers a second one, the server will return a `202` whose discriminated `type` will be `OAUTH`. However, `AuthCredentialAdditionalChallengeOneOf.yaml` only maps `EMAIL_OTP`, so the `202` response body for that case is both unschematised and undocumented here. SDK generators and API consumers reading this spec won't know how to deserialise that response. A sibling `OauthCredentialAdditionalChallenge` schema (and mapping entry) should be added alongside this PR, or at minimum the next PR in the stack should be called out explicitly so the omission is tracked. How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: openapi/paths/auth/auth_credentials.yaml
Line: 95-115
Comment:
**Missing OAUTH 202 challenge variant**
The PR description states "multiple OAuth credentials are allowed per internal account." When an account already has a verified OAUTH credential and a caller registers a second one, the server will return a `202` whose discriminated `type` will be `OAUTH`. However, `AuthCredentialAdditionalChallengeOneOf.yaml` only maps `EMAIL_OTP`, so the `202` response body for that case is both unschematised and undocumented here. SDK generators and API consumers reading this spec won't know how to deserialise that response. A sibling `OauthCredentialAdditionalChallenge` schema (and mapping entry) should be added alongside this PR, or at minimum the next PR in the stack should be called out explicitly so the omission is tracked.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: openapi/paths/auth/auth_credentials.yaml
Line: 15-20
Comment:
**Verify endpoint not yet updated**
The description tells consumers "activation still happens via `POST /auth/credentials/{id}/verify`" for OAUTH credentials, but the PR description explicitly notes the OAUTH verify branch ships in the next PR. Until that lands, any consumer who reads this spec and calls the verify endpoint with an OAUTH credential type will hit undocumented behaviour. Consider adding a brief note (e.g., "OAUTH verify support is coming") or coordinating the two PRs so the spec and implementation land atomically.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "feat: add OAUTH branch to auth credentia..." | Re-trigger Greptile
76dc700 to
4d23cd4
Compare
ed7f4ba to
1555e46
Compare
4d23cd4 to
465e7da
Compare
1555e46 to
6269e92
Compare
465e7da to
a83fde1
Compare
6269e92 to
37b459b
Compare
Adds the OAUTH branch to `AuthCredentialCreateRequestOneOf`, letting platforms register an OIDC-backed authentication credential on an Embedded Wallet internal account.
**Request shape**
- `POST /auth/credentials` body: `{ type: "OAUTH", accountId, oidcToken }` → 201 `AuthMethod`.
**Schemas added**
- `OauthCredentialCreateRequestFields` — `{ type: "OAUTH", oidcToken }` (variant single-value enum on `type`).
- `OauthCredentialCreateRequest` — `allOf(AuthCredentialCreateRequest, OauthCredentialCreateRequestFields)`; wire body is `{ type, accountId, oidcToken }` (accountId inherited from the base).
**Wire-up**
- `AuthCredentialCreateRequestOneOf.yaml` discriminator map extended with `OAUTH → OauthCredentialCreateRequest`.
- OAuth request example added to `POST /auth/credentials`.
- Endpoint description updated to note OAuth's inline `iat`/`iss` validation and that activation still goes through `/verify`.
- `.stainless/stainless.yml` registers the two new schemas under `auth.credentials`.
**OIDC constraints (documented on the `oidcToken` field)**
- Grid fetches the issuer's signing key from the `iss` claim's `.well-known` OpenID configuration and verifies the token signature.
- Token's `iat` claim must be less than 60 seconds before the request timestamp.
**Notes**
- Multiple OAuth credentials are allowed per internal account (no analogue to `EMAIL_OTP_CREDENTIAL_ALREADY_EXISTS`).
- This PR only wires the create flow; `POST /auth/credentials/{id}/verify` gets its own OAUTH branch in the next PR in the stack.
- Bundled `openapi.yaml` and `mintlify/openapi.yaml` regenerated via `make build`.
37b459b to
ad0846b
Compare
|
OauthCredentialAdditionalChallenge is in a child PR |

Adds the OAUTH branch to
AuthCredentialCreateRequestOneOf, letting platforms register an OIDC-backed authentication credential on an Embedded Wallet internal account.Request shape
POST /auth/credentialsbody:{ type: "OAUTH", accountId, oidcToken }→ 201AuthMethod.Schemas added
OauthCredentialCreateRequestFields—{ type: "OAUTH", oidcToken }(variant single-value enum ontype).OauthCredentialCreateRequest—allOf(AuthCredentialCreateRequest, OauthCredentialCreateRequestFields); wire body is{ type, accountId, oidcToken }(accountId inherited from the base).AuthCredentialCreateRequestOneOf.yamldiscriminator map extended withOAUTH → OauthCredentialCreateRequest.Notes
EMAIL_OTP_CREDENTIAL_ALREADY_EXISTS).POST /auth/credentials/{id}/verifygets its own OAUTH branch in the next PR in the stack.openapi.yamlandmintlify/openapi.yamlregenerated viamake build.