add Embedded Wallet Auth endpoint for Email OTP challenge#350
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-python studio · code · diff
✅ grid-typescript 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. |
83f4592 to
09412e0
Compare
0feee72 to
2421d72
Compare
2421d72 to
1889c01
Compare
09412e0 to
6ca7978
Compare
1889c01 to
ace9654
Compare
6ca7978 to
445daad
Compare
ace9654 to
fdaaf7d
Compare
445daad to
c3c47fb
Compare
c3c47fb to
f78dfa0
Compare
fdaaf7d to
3f57f28
Compare
Greptile SummaryThis PR adds
Confidence Score: 4/5Safe to merge after correcting the path parameter description — the wrong entity name would mislead API consumers into passing an internal account ID instead of a credential ID. One P1 doc bug: the openapi/paths/auth/auth_credentials_{id}_challenge.yaml — path parameter description on line 19
|
| Filename | Overview |
|---|---|
| openapi/paths/auth/auth_credentials_{id}_challenge.yaml | New endpoint spec for POST /auth/credentials/{id}/challenge; path parameter description incorrectly names the entity as "internal account" when {id} is the credential (AuthMethod) ID |
| .stainless/stainless.yml | Adds challenge: post /auth/credentials/{id}/challenge to the auth.credentials resource methods — straightforward and correct |
| openapi/openapi.yaml | Adds the /auth/credentials/{id}/challenge path $ref to the root OpenAPI index — correct |
| openapi.yaml | Generated bundle — includes the challengeAuthCredential operation inlined; inherits the path param description issue from the source file |
| mintlify/openapi.yaml | Generated bundle for Mintlify docs — mirrors openapi.yaml; no independent issues |
Sequence Diagram
sequenceDiagram
participant Client
participant GridAPI
participant EmailService
Client->>GridAPI: POST /auth/credentials (EMAIL_OTP)
GridAPI-->>Client: 201 AuthMethod {id: "AuthMethod:abc…"}
GridAPI->>EmailService: Send OTP email
Note over Client: OTP missed or expired
Client->>GridAPI: POST /auth/credentials/{id}/challenge
GridAPI-->>Client: 200 AuthMethod
GridAPI->>EmailService: Re-send OTP email
Client->>GridAPI: POST /auth/credentials/{id}/verify {otp, clientPublicKey}
GridAPI-->>Client: 200 AuthSession {encryptedSessionSigningKey}
Prompt To Fix All With AI
This is a comment left during a code review.
Path: openapi/paths/auth/auth_credentials_{id}_challenge.yaml
Line: 19
Comment:
**Path parameter description identifies the wrong entity**
The `id` path parameter description says "The id of the internal account" but `{id}` in `/auth/credentials/{id}/challenge` is the **credential ID** (`AuthMethod.id`, e.g. `AuthMethod:019542f5-…`), not the internal account ID (`InternalAccount:…`). These carry different type prefixes; a developer reading this description would likely pass the wrong ID and get a 404. The verify endpoint has the same mismatch (inherited from the parent PR), so the error is consistent across both, but still wrong.
```suggestion
description: The id of the authentication credential to re-challenge.
```
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_{id}_challenge.yaml
Line: 3-11
Comment:
**Behavior for non-EMAIL_OTP credential types is undocumented**
The description only covers `EMAIL_OTP` credentials. It does not clarify what happens when this endpoint is called for other registered credential types (passkey, OAuth). If non-OTP types return a `400`, callers benefit from knowing this upfront — especially since the endpoint is on a generic `/auth/credentials/{id}` resource that encompasses all credential types.
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_{id}_challenge.yaml
Line: 23-53
Comment:
**Missing `429 Too Many Requests` response for OTP rate limiting**
This endpoint triggers a new OTP email on every call. If the backend rate-limits resend requests (which is standard practice to prevent email flooding / OTP abuse), a `429` response should be documented so clients can handle backoff gracefully. Consider adding it alongside the existing `400`/`401`/`404`/`500` responses.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "feat: add POST /auth/credentials/{id}/ch..." | Re-trigger Greptile
| responses: | ||
| '200': | ||
| description: Challenge re-issued for the authentication credential | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: ../../components/schemas/auth/AuthMethod.yaml | ||
| '400': | ||
| description: Bad request | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: ../../components/schemas/errors/Error400.yaml | ||
| '401': | ||
| description: Unauthorized | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: ../../components/schemas/errors/Error401.yaml | ||
| '404': | ||
| description: Internal account not found | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: ../../components/schemas/errors/Error404.yaml | ||
| '500': | ||
| description: Internal service error | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: ../../components/schemas/errors/Error500.yaml |
There was a problem hiding this comment.
Missing
429 Too Many Requests response for OTP rate limiting
This endpoint triggers a new OTP email on every call. If the backend rate-limits resend requests (which is standard practice to prevent email flooding / OTP abuse), a 429 response should be documented so clients can handle backoff gracefully. Consider adding it alongside the existing 400/401/404/500 responses.
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/auth/auth_credentials_{id}_challenge.yaml
Line: 23-53
Comment:
**Missing `429 Too Many Requests` response for OTP rate limiting**
This endpoint triggers a new OTP email on every call. If the backend rate-limits resend requests (which is standard practice to prevent email flooding / OTP abuse), a `429` response should be documented so clients can handle backoff gracefully. Consider adding it alongside the existing `400`/`401`/`404`/`500` responses.
How can I resolve this? If you propose a fix, please make it concise.3f57f28 to
11d622e
Compare
f78dfa0 to
10ae784
Compare
11d622e to
f8db4db
Compare
10ae784 to
6081086
Compare
6081086 to
9bdfe1f
Compare
f8db4db to
c8debca
Compare
c8debca to
b3101fe
Compare
Resend an authentication credential challenge without rebuilding the credential. For `EMAIL_OTP`, this re-issues the OTP email so the user can call `POST /auth/credentials/{id}/verify` again after the previous code expired or was missed.
**Endpoint defined**
- `POST /auth/credentials/{id}/challenge` — no request body; `{id}` is the `AuthMethod.id` returned from `POST /auth/credentials` (same path-param semantics as `/verify`). Returns `AuthMethod` (200).
**Response shape**
- Reuses `AuthMethod` from the parent PR — `id`, `accountId`, `type`, `nickname`, `createdAt`, `updatedAt`. No session fields; verification still happens on `/verify`.
**Stainless**
- `challenge` method added to the `auth.credentials` resource in `.stainless/stainless.yml`.
**Bundled**
- `openapi/openapi.yaml` registers the new path; `openapi.yaml` and `mintlify/openapi.yaml` regenerated via `make build`.
b3101fe to
80365ef
Compare

Endpoint
POST /auth/credentials/{id}/challenge— re-issue the challenge for an existing credential without rebuilding it. ForEMAIL_OTP, triggers a new OTP email so the user can call/verifyagain after a missed or expired code.Request / response
Resources
No new schemas. Reuses
AuthMethodfrom the parent PR (#349). Stainless config addschallengeto theauth.credentialsresource methods.