BasicAuthentication policy deployment error troubleshooting

You're viewing Apigee Edge documentation.
Go to the Apigee X documentation.
info

UserNameRequired

Error message

Deployment of the API proxy through either the Edge UI or Edge management API fails with this error message:

Error Deploying Revision revision_number to env_name
BasicAuthenticationPolicy: Username element must be present for operation operation.

Example error message

Error Deploying Revision 2 to test
BasicAuthenticationPolicy: Username element must be present for Encode operation.

Example screenshot

Cause

The deployment of the API Proxy fails if the <User> element is not defined in the BasicAuthentication policy. The <User> element is mandatory for both Encode and Decode operations.

Diagnosis

  1. Examine all the BasicAuthentication policies used in the API proxy. If there is any policy where the <User> element is not specified, then that's the cause of the error. The <User> element is mandatory in BasicAuthentication policy for Encode or Decode operations.

    The sample BasicAuthentication policy shown below is used for Encode operation, but doesn't have the <User> element defined:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <BasicAuthentication name="ApplyBasicAuthHeader">
      <DisplayName>ApplyBasicAuthHeader</DisplayName>
      <Operation>Encode</Operation>
      <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
      <Password ref="BasicAuth.credentials.password"/>
      <AssignTo createNew="false">request.header.Authorization</AssignTo>
    </BasicAuthentication>
    

    The deployment fails with the below error:

    BasicAuthenticationPolicy: Username element must be present for Encode operation.
    

Resolution

Ensure that the <User> element is defined within the BasicAuthentication policy for Encode or Decode operation.

To correct the example shown above, include the <User>element within the policy as shown below:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BasicAuthentication name="ApplyBasicAuthHeader">
    <DisplayName>ApplyBasicAuthHeader</DisplayName>
    <Operation>Encode</Operation>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <User ref="BasicAuth.credentials.username"/>
    <Password ref="BasicAuth.credentials.password"/>
    <AssignTo createNew="false">request.header.Authorization</AssignTo>
</BasicAuthentication>

PasswordRequired

Error message

Deployment of the API proxy through either the Edge UI or Edge management API fails with this error message:

Error Deploying Revision revision_number to env_name
BasicAuthenticationPolicy: Password element must be present for operation operation.

Example error message

Error Deploying Revision 2 to test
BasicAuthenticationPolicy: Password element must be present for Encode operation.

Example screenshot

Cause

The deployment of the API Proxy fails if the <Password> element is not defined in the BasicAuthentication policy. The <Password> element is mandatory for both Encode and Decode operations.

Diagnosis

  1. Examine all the BasicAuthentication policies used in the API proxy. If there is any policy where the <Password> element is not defined, then that's the cause of the error. The <Password> element is mandatory in the BasicAuthentication policy for Encode or Decode operation.

    The sample BasicAuthentication policy shown below is used for Encode operation, but doesn't have the <Password> element defined:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <BasicAuthentication name="ApplyBasicAuthHeader">
      <DisplayName>ApplyBasicAuthHeader</DisplayName>
      <Operation>Encode</Operation>
      <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
      <User ref="BasicAuth.credentials.username"/>
      <AssignTo createNew="false">request.header.Authorization</AssignTo>
    </BasicAuthentication>
    

    The deployment fails with the below error:

    BasicAuthenticationPolicy: Password element must be present for Encode operation.
    

Resolution

Ensure that the <Password> element is defined within the BasicAuthentication policy for Encode or Decode operation.

To correct the example shown above, include the <Password>element within the policy as shown below:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BasicAuthentication name="ApplyBasicAuthHeader">
    <DisplayName>ApplyBasicAuthHeader</DisplayName>
    <Operation>Encode</Operation>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <User ref="BasicAuth.credentials.username"/>
    <Password ref="BasicAuth.credentials.password"/>
    <AssignTo createNew="false">request.header.Authorization</AssignTo>
</BasicAuthentication>

AssignToRequired

Error message

Deployment of the API proxy through either the Edge UI or Edge management API fails with this error message:

Error Deploying Revision revision_number to env_name
BasicAuthenticationPolicy: AssignTo element must be present for operation operation.

Example error message

Error Deploying Revision 2 to test
BasicAuthenticationPolicy: AssignTo element must be present for Encode operation.

Example screenshot

Cause

The deployment of the API Proxy fails if the <AssignTo> element is not defined in the BasicAuthentication policy. The <AssignTo> element is mandatory for both Encode and Decode operations.

Diagnosis

  1. Examine all the BasicAuthentication policies used in the API proxy. If there is any policy where the element <AssignTo> is not defined, then that's the cause of the error. The <AssignTo> element is mandatory to be defined in BasicAuthentication policy for both Encode and Decode operations.

    The sample BasicAuthentication policy shown below is used for Encode operation, but doesn't have the <AssignTo> element defined:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <BasicAuthentication name="ApplyBasicAuthHeader">
      <DisplayName>ApplyBasicAuthHeader</DisplayName>
      <Operation>Encode</Operation>
      <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
      <User ref="BasicAuth.credentials.username"/>
      <Password ref="BasicAuth.credentials.password"/>
    </BasicAuthentication>
    

    The deployment fails with the below error:

    BasicAuthenticationPolicy: AssignTo element must be present for Encode operation.
    

Resolution

Ensure that the <AssignTo> element is defined within the BasicAuthentication policy for Encode or Decode operation.

To correct the example shown above, include the <AssignTo>element within the policy as shown below:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BasicAuthentication name="ApplyBasicAuthHeader">
    <DisplayName>ApplyBasicAuthHeader</DisplayName>
    <Operation>Encode</Operation>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <User ref="BasicAuth.credentials.username"/>
    <Password ref="BasicAuth.credentials.password"/>
    <AssignTo createNew="false">request.header.Authorization</AssignTo>
</BasicAuthentication>

SourceRequired

Error message

Deployment of the API proxy through either the Edge UI or Edge management API fails with this error message:

Error Deploying Revision revision_number to env_name
BasicAuthenticationPolicy: Source element must be present for Decode operation.

Example error message

Error Deploying Revision 2 to test
BasicAuthenticationPolicy: Source element must be present for Decode operation.

Example screenshot

Cause

The deployment of the API Proxy fails if the <Source> element is not defined in the BasicAuthentication policy that is used for decoding operation. The <Source> element is mandatory if the <Operation> is specified as Decode in the BasicAuthentication policy.

Diagnosis

  1. Examine all the BasicAuthentication policies used in the API proxy. If there is any policy where the element <Source> is not defined and the <Operation> element is defined as Decode, then that's the cause of the error. The <Source> element is mandatory if the <Operation> is specified as Decode in the BasicAuthentication policy.

    The sample BasicAuthentication policy shown below is used for Decode operation, but doesn't have the <Source> element defined:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <BasicAuthentication name="ApplyBasicAuthHeader">
      <DisplayName>ApplyBasicAuthHeader</DisplayName>
      <Operation>Decode</Operation>
      <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
      <User ref="BasicAuth.credentials.username"/>
      <Password ref="BasicAuth.credentials.password"/>
      <AssignTo createNew="false">request.header.Authorization</AssignTo>
    </BasicAuthentication>
    

    The deployment fails with the below error:

    BasicAuthenticationPolicy: Source element must be present for Decode operation.
    

Resolution

Ensure that the <Source> element is defined in BasicAuthentication policy when it is used for Decode operation.

To correct the example shown above, include the <Source>element within the policy as shown below:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BasicAuthentication name="ApplyBasicAuthHeader">
    <DisplayName>ApplyBasicAuthHeader</DisplayName>
    <Operation>Decode</Operation>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <User ref="BasicAuth.credentials.username"/>
    <Password ref="BasicAuth.credentials.password"/>
    <AssignTo createNew="false">request.header.Authorization</AssignTo>
    <Source>request.header.Authorization</Source>
</BasicAuthentication>