Skip to main content

Authenticate yourself to get an access token

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

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

Format
application/json
Description

Multi factor authentication is activated for this user. After calling this, you need to call '/authentication/mfa' with a valid multi factor code.

  • name"SecondFactorRequired"
Content-Type: application/json

{
"name": "SecondFactorRequired"
}
{
"properties": {
"name": {
"enum": [
"SecondFactorRequired"
],
"type": "string"
}
},
"type": "object"
}

No response content specified.

Usage examples​

$ curl \
--fail \
--location \
-X POST \
-d '{"email":"a.lovelace@example.com","password":"string"}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/authenticate?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.authenticate({
"data": {
"email": "a.lovelace@example.com",
"password": "string"
},
"queryParameters": {
"cookieOnly": true
}
});

assertStatus(response, 200);

use \Mittwald\ApiClient\Generated\V2\Clients\User\Authenticate\AuthenticateRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\User\Authenticate\AuthenticateRequestBody;

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

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

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

var_dump($response->getBody();

On this page