Skip to content

add Embedded Wallet Auth endpoint for Email OTP challenge#350

Merged
DhruvPareek merged 1 commit intomainfrom
04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp
Apr 22, 2026
Merged

add Embedded Wallet Auth endpoint for Email OTP challenge#350
DhruvPareek merged 1 commit intomainfrom
04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp

Conversation

@DhruvPareek
Copy link
Copy Markdown
Contributor

@DhruvPareek DhruvPareek commented Apr 18, 2026

Endpoint

  • POST /auth/credentials/{id}/challenge — re-issue the challenge for an existing credential without rebuilding it. For EMAIL_OTP, triggers a new OTP email so the user can call /verify again after a missed or expired code.

Request / response

POST /auth/credentials/{id}/challenge
(no body)

→ 200 AuthMethod   // { id, accountId, type, nickname, createdAt, updatedAt }

Resources

No new schemas. Reuses AuthMethod from the parent PR (#349). Stainless config adds challenge to the auth.credentials resource methods.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
grid-flow-builder Ready Ready Preview, Comment Apr 22, 2026 3:24am

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 18, 2026

✱ Stainless preview builds

This PR will update the grid SDKs with the following commit messages.

kotlin

feat(api): add resendChallenge method to credentials

openapi

feat(api): add resend challenge method to auth credentials

python

feat(api): add resend_challenge method to auth.credentials

typescript

feat(api): add resendChallenge method to auth.credentials
grid-openapi studio · code

Your SDK build had at least one "note" diagnostic.
generate ✅

grid-typescript studio · code

Your SDK build had at least one "note" diagnostic.
generate ✅build ✅lint ✅test ✅

npm install https://pkg.stainless.com/s/grid-typescript/56b243fab3e8ef1d70625090ec7af48a066ce735/dist.tar.gz
grid-python studio · code

Your SDK build had at least one "note" diagnostic.
generate ✅build ✅lint ✅test ✅

pip install https://pkg.stainless.com/s/grid-python/410fc0517f266609fcd9f864728b69e081fdd926/grid-0.0.1-py3-none-any.whl
grid-kotlin studio · code

generate ✅build ✅lint ✅test ⏳

⏳ These are partial results; builds are still running.


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-04-22 04:02:59 UTC

@DhruvPareek DhruvPareek changed the title feat: add POST /auth/credentials/{id}/challenge to resend EMAIL_OTP add Embedded Wallet Auth endpoint for Email OTP challenge Apr 18, 2026
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_embedded_wallet_auth_endpoints_for_email_otp branch from 83f4592 to 09412e0 Compare April 20, 2026 17:18
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp branch from 0feee72 to 2421d72 Compare April 20, 2026 17:18
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp branch from 2421d72 to 1889c01 Compare April 20, 2026 22:29
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_embedded_wallet_auth_endpoints_for_email_otp branch from 09412e0 to 6ca7978 Compare April 20, 2026 22:29
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp branch from 1889c01 to ace9654 Compare April 20, 2026 23:10
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_embedded_wallet_auth_endpoints_for_email_otp branch from 6ca7978 to 445daad Compare April 20, 2026 23:10
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp branch from ace9654 to fdaaf7d Compare April 21, 2026 02:18
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_embedded_wallet_auth_endpoints_for_email_otp branch from 445daad to c3c47fb Compare April 21, 2026 02:18
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_embedded_wallet_auth_endpoints_for_email_otp branch from c3c47fb to f78dfa0 Compare April 21, 2026 06:37
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp branch from fdaaf7d to 3f57f28 Compare April 21, 2026 06:37
@DhruvPareek DhruvPareek marked this pull request as ready for review April 21, 2026 17:39
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 21, 2026

Greptile Summary

This PR adds POST /auth/credentials/{id}/challenge — a single new endpoint that re-issues the challenge for an existing credential (triggering a new OTP email for EMAIL_OTP types) so users can call /verify again after a missed or expired code. The Stainless config, both OpenAPI bundles, and the source path file are all updated consistently.

  • The id path parameter is described as "The id of the internal account" but {id} is the credential ID (AuthMethod:…), not the internal account ID (InternalAccount:…) — developers following the description would pass the wrong value and receive a 404.

Confidence Score: 4/5

Safe 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 id path param description says "internal account" when it must be the AuthMethod/credential ID. This would cause 404s for developers who follow the description literally. The P2 findings (undocumented non-OTP behavior, missing 429) are non-blocking.

openapi/paths/auth/auth_credentials_{id}_challenge.yaml — path parameter description on line 19

Important Files Changed

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}
Loading

Fix All in Claude Code

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

Comment thread openapi/paths/auth/auth_credentials_{id}_challenge.yaml Outdated
Comment thread openapi/paths/auth/auth_credentials_{id}_challenge.yaml
Comment thread openapi/paths/auth/auth_credentials_{id}_challenge.yaml
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp branch from 3f57f28 to 11d622e Compare April 21, 2026 19:15
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_embedded_wallet_auth_endpoints_for_email_otp branch from f78dfa0 to 10ae784 Compare April 21, 2026 19:15
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp branch from 11d622e to f8db4db Compare April 22, 2026 00:36
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_embedded_wallet_auth_endpoints_for_email_otp branch from 10ae784 to 6081086 Compare April 22, 2026 00:36
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_embedded_wallet_auth_endpoints_for_email_otp branch from 6081086 to 9bdfe1f Compare April 22, 2026 00:46
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp branch from f8db4db to c8debca Compare April 22, 2026 00:46
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp branch from c8debca to b3101fe Compare April 22, 2026 00:50
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp branch from b3101fe to 80365ef Compare April 22, 2026 01:54
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp branch from 80365ef to 65bdbc6 Compare April 22, 2026 03:14
@DhruvPareek DhruvPareek changed the base branch from 04-17-feat_add_embedded_wallet_auth_endpoints_for_email_otp to graphite-base/350 April 22, 2026 03:23
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp branch from 65bdbc6 to 333beeb Compare April 22, 2026 03:23
@graphite-app graphite-app Bot changed the base branch from graphite-base/350 to main April 22, 2026 03:24
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`.
@DhruvPareek DhruvPareek force-pushed the 04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp branch from 333beeb to e60b5d8 Compare April 22, 2026 03:24
@DhruvPareek DhruvPareek merged commit db29622 into main Apr 22, 2026
10 checks passed
@DhruvPareek DhruvPareek deleted the 04-17-feat_add_post__auth_credentials__id__challenge_to_resend_email_otp branch April 22, 2026 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants