# Login

This endpoint logs in the user and returns the access token

Endpoint: POST /api/v1/oauth/token
Version: 1.2.0
Security: partner

## Security:

  - `partner` (unknown)
    oauth2

## Request fields (application/x-www-form-urlencoded):

  - `grant_type` (string, required)
    The grant type.
    Enum: "PASSWORD", "RFID", "REFRESH_TOKEN", "XID", "NFC", "DEVICE"

  - `serial_number` (string, required)
    The unique serial number of the machine.

  - `machine_type` (string, required)
    The machine type name of the device.

  - `locale` (string)
    The locale, if there is the need to override it during the login process.
    Example: en_US

  - `measurement_system` (string)
    The measurement system, if there is the need to override it during the login process.
    Enum: "METRIC", "US_CUSTOMARY", "IMPERIAL"

  - `machine_sw_version` (string)
    The version of the Software running on the Machine.
    Example: 5.3.7.323

  - `egym_sw_version` (string)
    The version of the EGYM Software running on the machine.
    Example: 3.589

  - `device_token` (string)
    The EGYM-signed device token

  - `obfuscated_user_id` (string)
    The user ID for authentication

  - `username` (string)
    Username. Mandatory if the grant_type is password.

  - `password` (string)
    Password. Mandatory if the grant_type is password.

  - `rfid` (string)
    RFID serial number. Mandatory if the grant_type is rfid.

  - `rfid_format` (string)
    RFID Format. Mandatory if the grant_type is rfid.
    Enum: "HITAG1", "HITAG2", "EM4001", "EM4002", "EM4100", "EM4102", "EM4022", "MIFARE", "LEGIC", "NFC_EGYM_APPLE", "NFC_EGYM_GOOGLE", "NFC_EXTERNAL_APPLE", "NFC_EXTERNAL_GOOGLE"

  - `refresh_token` (string)
    The refresh token. Mandatory if the grant_type is refresh_token.

  - `xid` (string)
    xID is used to log in a user together with the passcode. Mandatory if the grant_type is xid.

  - `passcode` (string)
    The passcode. Mandatory if the grant_type is xid.

  - `payload` (string)
    The NFC payload.
The NFC payload is a string that represents the NFC data contained in a wallet pass.
The string must be no more than 64 bytes long and may only contain ASCII characters.
In the case of an Apple Wallet pass, corresponds to the `message` property of the
[`Pass.NFC`](https://developer.apple.com/documentation/walletpasses/pass/nfc#properties)
object.
In the case of a Google Wallet pass, corresponds to the `smartTapRedemptionValue` property
of the
[`GenericObject`](https://developers.google.com/wallet/reference/rest/v1/genericobject#GenericObject.FIELDS.smart_tap_redemption_value)
resource.

  - `transponder_type` (string)
    The pass type of the NFC data. Can be Apple or Google.
    Enum: "APPLE", "GOOGLE"

  - `issuer_id` (any)
    The issuer of the NFC data. Required if keySlot is not provided.

  - `issuer_id.passTypeId` (string)

  - `issuer_id.collectorId` (integer)

  - `configuration_index` (object)

  - `configuration_index.configurationIndex` (integer)

## Response 200:

  - `200` (unknown)
    Ok

## Response 200 fields (application/json):

  - `access_token` (string)
    The access token

  - `expiration_time` (integer)
    The expiration time of the access token
    Example: 1672531200000

  - `refresh_token` (string)
    The refresh token

  - `token_type` (string)
    The type of token

## Response 400:

  - `400` (unknown)
    Bad Request

## Response 400 fields (application/json):

  - `timestamp` (integer)
    Unix epoch milliseconds when the error occurred.
    Example: 1775122463109

  - `path` (string)
    The request path that triggered the error.
    Example: /api/v1/measurements/body/history

  - `status` (integer)
    HTTP status code.
    Example: 400

  - `error` (string)
    Short textual description of the HTTP status.
    Example: Bad Request

  - `requestId` (string)
    Unique identifier for the request, useful for correlating logs and support tickets.
    Example: d0c0fd9e-236

  - `message` (string)
    Human-readable description of the error.
    Example: Invalid request parameters: value must be greater than or equal to 1 and less than or equal to 1000

  - `fieldErrors` (array)
    List of field-level validation errors. Only present when the error was caused by request-body binding failures or custom form validation.

  - `fieldErrors.name` (string)
    The field name.

  - `fieldErrors.message` (string)
    The error message.
    Example: Must not be null.

  - `fieldErrors.rejectedValue` (any)
    The rejected value.
    Example: Must not be null.

  - `errorCode` (string)
    Machine-readable error code for domain-specific errors. Only present for exceptions that carry a custom error code.
    Example: USER_NOT_FOUND

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 404:

  - `404` (unknown)
    Not Found

## Response 404 fields (application/json):

  - `timestamp` (integer)
    Unix epoch milliseconds when the error occurred.
    Example: 1775122463109

  - `path` (string)
    The request path that triggered the error.
    Example: /api/v1/measurements/body/history

  - `status` (integer)
    HTTP status code.
    Example: 400

  - `error` (string)
    Short textual description of the HTTP status.
    Example: Bad Request

  - `requestId` (string)
    Unique identifier for the request, useful for correlating logs and support tickets.
    Example: d0c0fd9e-236

  - `message` (string)
    Human-readable description of the error.
    Example: Invalid request parameters: value must be greater than or equal to 1 and less than or equal to 1000

  - `fieldErrors` (array)
    List of field-level validation errors. Only present when the error was caused by request-body binding failures or custom form validation.

  - `fieldErrors.name` (string)
    The field name.

  - `fieldErrors.message` (string)
    The error message.
    Example: Must not be null.

  - `fieldErrors.rejectedValue` (any)
    The rejected value.
    Example: Must not be null.

  - `errorCode` (string)
    Machine-readable error code for domain-specific errors. Only present for exceptions that carry a custom error code.
    Example: USER_NOT_FOUND

## Response 500:

  - `500` (unknown)
    Internal Server Error

## Response 500 fields (application/json):

  - `timestamp` (integer)
    Unix epoch milliseconds when the error occurred.
    Example: 1775122463109

  - `path` (string)
    The request path that triggered the error.
    Example: /api/v1/measurements/body/history

  - `status` (integer)
    HTTP status code.
    Example: 400

  - `error` (string)
    Short textual description of the HTTP status.
    Example: Bad Request

  - `requestId` (string)
    Unique identifier for the request, useful for correlating logs and support tickets.
    Example: d0c0fd9e-236

  - `message` (string)
    Human-readable description of the error.
    Example: Invalid request parameters: value must be greater than or equal to 1 and less than or equal to 1000

  - `fieldErrors` (array)
    List of field-level validation errors. Only present when the error was caused by request-body binding failures or custom form validation.

  - `fieldErrors.name` (string)
    The field name.

  - `fieldErrors.message` (string)
    The error message.
    Example: Must not be null.

  - `fieldErrors.rejectedValue` (any)
    The rejected value.
    Example: Must not be null.

  - `errorCode` (string)
    Machine-readable error code for domain-specific errors. Only present for exceptions that carry a custom error code.
    Example: USER_NOT_FOUND

