Skip to content

Commit 10947c8

Browse files
authored
fix(graphql-api): remove verify_totp, a mutation that does not exist (#91)
The page documented a `verify_totp` mutation, an input type `VerifyTOTPRequest`, a `token` param and a `recovery_code` response field. None of them exist in the schema. TOTP is verified with verify_otp(is_totp: true), the same mutation used for email and SMS. Also on the login response table: `totp_base64_url` and `totp_token` are not AuthResponse fields. The real ones are authenticator_scanner_image, authenticator_secret and authenticator_recovery_codes. verify_otp's own params table was missing is_totp and state. The {#verify_totp} anchor is kept so existing deep links resolve.
1 parent a2396b0 commit 10947c8

1 file changed

Lines changed: 24 additions & 12 deletions

File tree

‎docs/core/graphql-api.md‎

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ A mutation to login users using email and password. It accepts `params` of type
426426
Either `email` or `phone_number` is required to login
427427

428428
> Note: To enable MFA, go to dashboard and enable MFA for user. By default, TOTP MFA will be enabled. If SMTP details are provided then Mail OTP can also be enabled. One can only enable one MFA at a time.
429-
> For TOTP verification use `verify_totp` mutation, and for verifying mail OTP use `verify_otp` mutation.
429+
> Every second factor is verified with the same [`verify_otp`](#verify_otp) mutation — pass `is_totp: true` for an authenticator code, and omit it for an email or SMS code.
430430
431431
**Request Params**
432432

@@ -452,8 +452,9 @@ This mutation returns `AuthResponse` type with following keys
452452
| `id_token` | JWT token holding the user information |
453453
| `refresh_token` | When scope includes `offline_access`, Long living token is returned which can be used to get new access tokens. This is rotated with each request |
454454
| `user` | User object with its profile keys mentioned [above](#profile). |
455-
| `totp_base64_url` | If totp enabled, will get base64 url for QR code, which can be scanned on google authenticator |
456-
| `totp_token` | this token is for totp which need to passed in verify_totp mutation along with totp from your authenticator |
455+
| `authenticator_scanner_image` | If TOTP enrollment is in progress, a base64 QR image that can be scanned with an authenticator app |
456+
| `authenticator_secret` | The TOTP shared secret, for entering by hand when a QR code cannot be scanned |
457+
| `authenticator_recovery_codes` | Recovery codes, returned once when TOTP enrollment completes |
457458

458459
**Sample Mutation**
459460

@@ -734,6 +735,8 @@ Mutation to verify OTP sent to the user. It accepts `params` of type `VerifyOTPR
734735
| `email` | Email address of user | false |
735736
| `phone_number` | Phone number of user | false |
736737
| `otp` | OTP (One Time Password) sent to user email address | true |
738+
| `is_totp` | Set `true` when the code came from an authenticator app rather than email/SMS. Also completes TOTP enrollment after `totp_mfa_setup` | false |
739+
| `state` | Authorization-code grant flow state, to obtain a `code` for an in-progress `/authorize` request | false |
737740

738741
Either `email` or `phone_number` is required
739742

@@ -922,16 +925,25 @@ Lists the authenticated caller's own registered passkeys. Returns `[WebauthnCred
922925

923926
Deletes one of the authenticated caller's own passkeys by `id`. Returns `Response`. Requires authentication.
924927

925-
### `verify_totp`
928+
### Verifying TOTP {#verify_totp}
926929

927-
Mutation to verify TOTP generated by QR code. It accepts `params` of type `VerifyTOTPRequest` with following keys as parameter
930+
There is no separate `verify_totp` mutation. TOTP codes go through
931+
[`verify_otp`](#verify_otp) with `is_totp: true` — the same mutation that verifies
932+
email and SMS codes, so one code path handles every second factor.
928933

929-
**Request Params**
934+
**Request Params** (`VerifyOTPRequest`)
930935

931-
| Key | Description | Required |
932-
|---------|----------------------------------------------|----------|
933-
| `otp` | totp generated on authenticator app | true |
934-
| `token` | will be generated at time of login, named `totp_token` | true |
936+
| Key | Description | Required |
937+
|----------------|------------------------------------------------------|----------|
938+
| `email` | Email address of user | false |
939+
| `phone_number` | Phone number of user | false |
940+
| `otp` | Code from the authenticator app | true |
941+
| `is_totp` | Must be `true` for an authenticator code | true |
942+
| `state` | Authorization-code grant flow state | false |
943+
944+
Either `email` or `phone_number` is required — it identifies which pending login
945+
this code belongs to. The same call completes enrollment after
946+
[`totp_mfa_setup`](#totp_mfa_setup).
935947

936948
This mutation returns `AuthResponse` type with following keys
937949

@@ -945,13 +957,13 @@ This mutation returns `AuthResponse` type with following keys
945957
| `id_token` | JWT token holding the user information |
946958
| `refresh_token` | When scope includes `offline_access`, Long living token is returned which can be used to get new access tokens. This is rotated with each request |
947959
| `user` | User object with its profile keys mentioned [above](#profile). |
948-
| `recovery_code` | One will get a recovery code when signed in first time using TOTP. |
960+
| `authenticator_recovery_codes` | Recovery codes, returned once when TOTP enrollment completes. |
949961

950962
**Sample Mutation**
951963

952964
```graphql
953965
mutation {
954-
verify_totp(params: { token: "token", otp: "AB123C" }) {
966+
verify_otp(params: { email: "foo@bar.com", otp: "AB123C", is_totp: true }) {
955967
user {
956968
email
957969
given_name

0 commit comments

Comments
 (0)