Skip to content

Commit e4e2996

Browse files
committed
feat: add OAUTH branch to auth credential verify
Adds the OAUTH branch to `AuthCredentialVerifyRequestOneOf`, completing the create + verify flow for OIDC-backed authentication credentials on Embedded Wallet internal accounts. **Request shape** - `POST /auth/credentials/{id}/verify` body: `{ type: "OAUTH", oidcToken, clientPublicKey }` → 200 `AuthSession`. - `{id}` is the `AuthMethod.id` returned from `POST /auth/credentials`. **Schemas added** - `OauthCredentialVerifyRequestFields` — `{ type: "OAUTH", oidcToken, clientPublicKey }` (variant single-value enum on `type`). - `OauthCredentialVerifyRequest` — `allOf(AuthCredentialVerifyRequest, OauthCredentialVerifyRequestFields)`. **Wire-up** - `AuthCredentialVerifyRequestOneOf.yaml` discriminator map extended with `OAUTH → OauthCredentialVerifyRequest`. - OAuth example added on `POST /auth/credentials/{id}/verify`. - Endpoint description updated to cover the OAuth verify path, including its double-duty as the reauth path after a prior session expired. - 401 response description extended to cover OIDC validation failures (signature / issuer / `iat` freshness). - `.stainless/stainless.yml` registers the two new schemas and extends the "remove allOf $ref to AuthCredentialVerifyRequest" transform target list to include `OauthCredentialVerifyRequest.allOf[0]`. **OIDC constraints (documented on the `oidcToken` field)** - Fresh token required on every verify: `iat` must be less than 60 seconds before the request timestamp. - Grid re-validates the signature against the issuer's `.well-known` configuration on each verify. **Notes** - Pairs with `04-21-feat_add_oauth_branch_to_auth_credential_create` (the prior PR in the stack); together they make OAuth credentials usable end-to-end. The additional-credential challenge flow gets its own OAUTH branch in the next PR in the stack. - Bundled `openapi.yaml` and `mintlify/openapi.yaml` regenerated via `make build`.
1 parent ca6461a commit e4e2996

7 files changed

Lines changed: 136 additions & 10 deletions

File tree

.stainless/stainless.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ resources:
346346
email_otp_credential_additional_challenge_fields: '#/components/schemas/EmailOtpCredentialAdditionalChallengeFields'
347347
oauth_credential_create_request: '#/components/schemas/OauthCredentialCreateRequest'
348348
oauth_credential_create_request_fields: '#/components/schemas/OauthCredentialCreateRequestFields'
349+
oauth_credential_verify_request: '#/components/schemas/OauthCredentialVerifyRequest'
350+
oauth_credential_verify_request_fields: '#/components/schemas/OauthCredentialVerifyRequestFields'
349351
exchange_rates:
350352
methods:
351353
list:
@@ -857,6 +859,7 @@ openapi:
857859
args:
858860
target:
859861
- "$.components.schemas.EmailOtpCredentialVerifyRequest.allOf[0]"
862+
- "$.components.schemas.OauthCredentialVerifyRequest.allOf[0]"
860863
keys: [ "$ref" ]
861864

862865
codeflow:

mintlify/openapi.yaml

Lines changed: 37 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi.yaml

Lines changed: 37 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
oneOf:
22
- $ref: ./EmailOtpCredentialVerifyRequest.yaml
3+
- $ref: ./OauthCredentialVerifyRequest.yaml
34
discriminator:
45
propertyName: type
56
mapping:
67
EMAIL_OTP: ./EmailOtpCredentialVerifyRequest.yaml
8+
OAUTH: ./OauthCredentialVerifyRequest.yaml
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
title: OAuth Credential Verify Request
2+
allOf:
3+
- $ref: ./AuthCredentialVerifyRequest.yaml
4+
- $ref: ./OauthCredentialVerifyRequestFields.yaml
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
type: object
2+
required:
3+
- type
4+
- oidcToken
5+
- clientPublicKey
6+
properties:
7+
type:
8+
type: string
9+
enum:
10+
- OAUTH
11+
description: Discriminator value identifying this as an OAuth verification.
12+
oidcToken:
13+
type: string
14+
description: >-
15+
OIDC ID token issued by the identity provider. For reauthentication
16+
after a prior session expired, supply a fresh token — the token's
17+
`iat` claim must be less than 60 seconds before the request
18+
timestamp. Grid fetches the issuer's signing key from the `iss`
19+
claim's `.well-known` OpenID configuration and verifies the token
20+
signature.
21+
example: eyJhbGciOiJSUzI1NiIsImtpZCI6ImFiYzEyMyIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJzdWIiOiIxMTIyMzM0NDU1IiwiYXVkIjoiMTIzNDU2Ny5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbSIsImVtYWlsIjoidXNlckBleGFtcGxlLmNvbSIsImlhdCI6MTc0NjczNjUwOSwiZXhwIjoxNzQ2NzQwMTA5fQ.signature
22+
clientPublicKey:
23+
type: string
24+
description: >-
25+
Client-generated P-256 public key, hex-encoded in uncompressed SEC1
26+
format (0x04 prefix followed by the 32-byte X and 32-byte Y
27+
coordinates; 130 hex characters total). The matching private key
28+
must remain on the client. Grid encrypts the session signing key
29+
returned in the response to this public key. The key is ephemeral
30+
and one-time-use per verification request.
31+
example: 04f45f2a22c908b9ce09a7150e514afd24627c401c38a4afc164e1ea783adaaa31d4245acfb88c2ebd42b47628d63ecabf345484f0a9f665b63c54c897d5578be2

openapi/paths/auth/auth_credentials_{id}_verify.yaml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,18 @@ post:
66
77
88
For `EMAIL_OTP` credentials, supply the one-time password that was
9-
emailed to the user along with a client-generated public key. On
10-
success, the response contains an `encryptedSessionSigningKey` that is
11-
encrypted to the supplied `clientPublicKey`, along with an `expiresAt`
12-
timestamp marking when the session expires. The `clientPublicKey` is
13-
ephemeral and one-time-use per verification request.
9+
emailed to the user along with a client-generated public key. For
10+
`OAUTH` credentials, supply a fresh OIDC token (`iat` must be less
11+
than 60 seconds before the request) along with the client-generated
12+
public key; this is also the reauthentication path after a prior
13+
session expired.
14+
15+
16+
On success, the response contains an `encryptedSessionSigningKey`
17+
that is encrypted to the supplied `clientPublicKey`, along with an
18+
`expiresAt` timestamp marking when the session expires. The
19+
`clientPublicKey` is ephemeral and one-time-use per verification
20+
request.
1421
operationId: verifyAuthCredential
1522
tags:
1623
- Embedded Wallet Auth
@@ -38,6 +45,12 @@ post:
3845
type: EMAIL_OTP
3946
otp: '123456'
4047
clientPublicKey: 04f45f2a22c908b9ce09a7150e514afd24627c401c38a4afc164e1ea783adaaa31d4245acfb88c2ebd42b47628d63ecabf345484f0a9f665b63c54c897d5578be2
48+
oauth:
49+
summary: Verify an OAuth credential
50+
value:
51+
type: OAUTH
52+
oidcToken: eyJhbGciOiJSUzI1NiIsImtpZCI6ImFiYzEyMyIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJzdWIiOiIxMTIyMzM0NDU1IiwiYXVkIjoiMTIzNDU2Ny5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbSIsImVtYWlsIjoidXNlckBleGFtcGxlLmNvbSIsImlhdCI6MTc0NjczNjUwOSwiZXhwIjoxNzQ2NzQwMTA5fQ.signature
53+
clientPublicKey: 04f45f2a22c908b9ce09a7150e514afd24627c401c38a4afc164e1ea783adaaa31d4245acfb88c2ebd42b47628d63ecabf345484f0a9f665b63c54c897d5578be2
4154
responses:
4255
'200':
4356
description: Authentication credential verified and session issued
@@ -52,7 +65,10 @@ post:
5265
schema:
5366
$ref: ../../components/schemas/errors/Error400.yaml
5467
'401':
55-
description: Unauthorized - invalid or expired OTP
68+
description: >-
69+
Unauthorized. Returned for an invalid or expired OTP (`EMAIL_OTP`)
70+
or for an OIDC token whose signature, issuer, or `iat` freshness
71+
check failed (`OAUTH`).
5672
content:
5773
application/json:
5874
schema:

0 commit comments

Comments
 (0)