Skip to main content

Validate your second factor

POST/v2/authenticate-mfa
API version
v2
Request method
POST
Operation ID
user-authenticate-mfa

Provide either multiFactorCode or passkeyCredential as second factor.

Request​

Responses​

Format
application/json
Description

Your authentication request was successful and you've got an access token.

  • expiresstring (date-time)required

    The expiration date of the token.

  • refreshTokenstringrequired

    Refresh token to refresh your access token even after it has expired.

  • tokenstringrequired

    Public token to identify yourself against the api gateway.

Content-Type: application/json

{
"expires": "1985-10-26T01:21:00.000Z",
"refreshToken": "string",
"token": "string"
}
{
"properties": {
"expires": {
"description": "The expiration date of the token.",
"format": "date-time",
"type": "string"
},
"refreshToken": {
"description": "Refresh token to refresh your access token even after it has expired.",
"type": "string"
},
"token": {
"description": "Public token to identify yourself against the api gateway.",
"type": "string"
}
},
"required": [
"token",
"refreshToken",
"expires"
],
"type": "object"
}

No response content specified.

Usage examples​

$ curl \
--fail \
--location \
-X POST \
-d '{"captchaToken":"string","email":"a.lovelace@example.com","multiFactorCode":"123456","passkeyCredential":{"challengeId":"6a1f0b1e-7d0c-4a43-9c1f-4f6c9b0f7a11","credential":{"authenticatorAttachment":"platform","clientExtensionResults":{},"id":"AN29uP9UVfVZ1X0WLKg3zA","rawId":"AN29uP9UVfVZ1X0WLKg3zA","response":{"authenticatorData":"8q2Xwa9qKcqUca3Qox8O-H9rqwjlNp1O5WHPOETZnigdAAAAAA","clientDataJSON":"eyJ0eXBlIjoid2ViYXV0aG4uZ2V0IiwiY2hhbGxlbmdlIjoicmNVYTE2MzRZVWFDc0JlYXNyb1RWdWRCYjRqTlNuS3pUR3pKOUVkTGxyQSIsIm9yaWdpbiI6Imh0dHBzOi8vc3R1ZGlvLm1pdHR3YWxkLmRlIiwiY3Jvc3NPcmlnaW4iOmZhbHNlfQ","signature":"MEUCIQD7nQ352E7fNAwHcgq5mMDsoeHQ0odAgekdw9tbs-Lc1gIgSBt2yLdJV_AcNx76CMsEP-S7LoJ_E0q-y19EAEWtwLI","userHandle":"NmMxYzFkMGUtNmYwZS00YTNjLTlkM2YtNWYyZDFkMGI5YTEx"},"type":"public-key"}},"password":"string"}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/authenticate-mfa?cookieOnly=true
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";

const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.user.authenticateMfa({
"data": {
"captchaToken": "string",
"email": "a.lovelace@example.com",
"multiFactorCode": "123456",
"passkeyCredential": {
"challengeId": "6a1f0b1e-7d0c-4a43-9c1f-4f6c9b0f7a11",
"credential": {
"authenticatorAttachment": "platform",
"clientExtensionResults": {},
"id": "AN29uP9UVfVZ1X0WLKg3zA",
"rawId": "AN29uP9UVfVZ1X0WLKg3zA",
"response": {
"authenticatorData": "8q2Xwa9qKcqUca3Qox8O-H9rqwjlNp1O5WHPOETZnigdAAAAAA",
"clientDataJSON": "eyJ0eXBlIjoid2ViYXV0aG4uZ2V0IiwiY2hhbGxlbmdlIjoicmNVYTE2MzRZVWFDc0JlYXNyb1RWdWRCYjRqTlNuS3pUR3pKOUVkTGxyQSIsIm9yaWdpbiI6Imh0dHBzOi8vc3R1ZGlvLm1pdHR3YWxkLmRlIiwiY3Jvc3NPcmlnaW4iOmZhbHNlfQ",
"signature": "MEUCIQD7nQ352E7fNAwHcgq5mMDsoeHQ0odAgekdw9tbs-Lc1gIgSBt2yLdJV_AcNx76CMsEP-S7LoJ_E0q-y19EAEWtwLI",
"userHandle": "NmMxYzFkMGUtNmYwZS00YTNjLTlkM2YtNWYyZDFkMGI5YTEx"
},
"type": "public-key"
}
},
"password": "string"
},
"queryParameters": {
"cookieOnly": true
}
});

assertStatus(response, 200);

use \Mittwald\ApiClient\Generated\V2\Clients\User\AuthenticateMfa\AuthenticateMfaRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\User\AuthenticateMfa\AuthenticateMfaRequestBody;

$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));

// TODO: Please consult the properties and constructor signature of
// AuthenticateMfaRequestBody to learn how to construct a valid instance
$body = new AuthenticateMfaRequestBody(/* TODO: ... */);

$request = (new AuthenticateMfaRequest(
body: $body
))
->withCookieOnly(true);
$response = $client->user()->authenticateMfa($request);

var_dump($response->getBody();

On this page