Get authentication from Google Authenticator

Get Authentication from Google Authenticator

This endpoint completes two-factor authentication using a Google Authenticator one-time password. It accepts the TOTP verification code along with optional device registration details and returns a Bearer token valid for 10 minutes. Use this step after initial credential-based login when 2FA is enabled for the partner account.

Endpoint

POST /api/auth/google/2FA

Authentication

Bearer token required. Obtain via:

POST https://api.banking.netevia.dev/api/auth/v2

Include in header: Authorization: Bearer {token}
Token lifetime: 10 minutes. Refresh via POST /api/auth/refresh.

When to use

Use this endpoint when a user account has Google Authenticator 2FA enabled and a time-based one-time password (TOTP) must be verified before the session token is issued. This is typically the second step in the authentication flow, called after the primary username/password login succeeds and the server signals that 2FA verification is required. Optionally, device details can be submitted alongside the code to register a trusted device and reduce future 2FA prompts.

Request Body

FieldTypeRequiredDescription
secretstringNoThe shared TOTP secret key associated with the Google Authenticator account.
verificationCodestringNoThe current 6-digit TOTP code generated by Google Authenticator.
oneTimeCodestringNoA single-use code issued during the initial authentication step, used to correlate the 2FA challenge.
tokenDevicestringNoA unique identifier token for the device being registered as trusted.
nameDevicestringNoA human-readable label for the trusted device (e.g., "Work Laptop").
{
  "secret": "JBSWY3DPEHPK3PXP",
  "verificationCode": "482910",
  "oneTimeCode": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "tokenDevice": "d3e4f5a6-b7c8-4d9e-a0f1-2b3c4d5e6f7a",
  "nameDevice": "Work Laptop"
}

Response

200 OK

FieldTypeDescription
tokenstringBearer token to include in the Authorization header for subsequent API calls.
expirationstring (date-time)ISO 8601 timestamp indicating when the token expires (10 minutes from issuance).
userIdintegerNumeric identifier of the authenticated user.
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
  "expiration": "2026-06-08T15:30:00Z",
  "userId": 100042
}

Error Codes

CodeWhen it happens
400Missing required fields or the TOTP code is malformed
401Token missing, expired, or the verification code is invalid or expired
403Insufficient permissions to complete 2FA for this account
404User account or 2FA configuration not found
500Internal server error

Common Mistakes

  • Submitting an expired TOTP code — Google Authenticator codes are valid for only 30 seconds; ensure device clocks are synchronized via NTP.
  • Omitting verificationCode — the current TOTP code is the primary credential for this step and must be present.
  • Reusing a oneTimeCode — these codes are single-use; re-submitting the same code after a successful or failed attempt will result in a 401 error.
  • Not refreshing the Bearer token before it expires — tokens issued by this endpoint last 10 minutes; use POST /api/auth/refresh proactively.

Related Endpoints

  • POST /api/auth/v2 — Initial username/password authentication that precedes this 2FA step.
  • POST /api/auth/refresh — Refreshes an existing Bearer token before or after expiration.

Example

curl -X POST https://api.banking.netevia.dev/api/auth/google/2FA \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "secret": "JBSWY3DPEHPK3PXP",
    "verificationCode": "482910",
    "oneTimeCode": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "tokenDevice": "d3e4f5a6-b7c8-4d9e-a0f1-2b3c4d5e6f7a",
    "nameDevice": "Work Laptop"
  }'
Body Params
string | null
string | null
string | null
string | null
string | null
Headers
string
enum
Defaults to application/json

Generated from available response content types

Allowed:
string
enum
Defaults to application/json

Generated from available request content types

Allowed:
Response

Language
Credentials
Bearer
JWT
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
text/plain
application/json
text/json