# Set or Update Authentication Method
source: https://developer.mastercard.com/mastercard-processing-core/documentation/sandbox-testing/card-lifecycle-management/set-update-auth-method/index.md

## Test case -- Success {#test-case--success}

This test case describes setting an authentication method for a specified contract (account contract or card contract).

**Sample request**

`PUT /contracts/70001/authentication-method`

```JSON
{
  "authenticationParameters": [
    {
      "name": "PHONE",
      "value": "+48 123456789"
    }
  ],
  "authenticationTypeCode": "3DS_EXT_ENROLLMENT",
  "authenticationTypeName": "TypeName"
}
```

**Sample response**

`204`

## Test case -- Fail -- Invalid authentication type code {#test-case--fail--invalid-authentication-type-code}

This test case describes an attempt to set an authentication method for a specified contract (account contract or card contract) using an invalid value in the `authenticationTypeCode` field in the request body.

For this test case, use the following information in the request:

|          Field           | Available value |
|--------------------------|-----------------|
| `authenticationTypeCode` | INVALID         |

**Sample request**

`PUT /contracts/70001/authentication-method`

```JSON
{
  "authenticationParameters": [
    {
      "name": "PHONE",
      "value": "+48 123456789"
    }
  ],
  "authenticationTypeCode": "INVALID",
  "authenticationTypeName": "TypeName"
}
```

**Sample response**

`400`

```JSON
{
    "Errors": {
        "Error": [
            {
                "Source": "MASTERCARD PROCESSING",
                "ReasonCode": "UNSUPPORTED_AUTHENTICATION_TYPE_CODE",
                "Description": "The authentication type code INVALID does not exist",
                "Recoverable": false
            }
        ]
    }
}
```

## Test case -- Fail -- Invalid authentication parameter name {#test-case--fail--invalid-authentication-parameter-name}

This test case describes an attempt to set an authentication method for a specified contract (account contract or card contract) using an invalid value in the `authenticationParameters.name` field in the request body.

For this test case, use the following information in the request:

|              Field              | Available value |
|---------------------------------|-----------------|
| `authenticationParameters.name` | INVALID         |

**Sample request**

`PUT /contracts/70001/authentication-method`

```JSON
{
  "authenticationParameters": [
    {
      "name": "INVALID",
      "value": "+48 123456789"
    }
  ],
  "authenticationTypeCode": "3DS_EXT_ENROLLMENT",
  "authenticationTypeName": "TypeName"
}
```

**Sample response**

`400`

```JSON
{
    "Errors": {
        "Error": [
            {
                "Source": "MASTERCARD PROCESSING",
                "ReasonCode": "UNSUPPORTED_PARAMETER_NAME",
                "Description": "The given authentication parameter name INVALID is not supported. ",
                "Recoverable": false
            }
        ]
    }
}
```

