getting UnresolvedVariable in basic authentication policy

Hello All,

i am trying to use username and password stored in KVM under

DK-UCS-DS-Credential as a basic auth username and password

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations name="Apigee-Credentials-Key-Value-Map" mapIdentifier="DK-UCS-DS-Credential" continueOnError="false" enabled="true">
    <DisplayName>Apigee Credentials Key Value Map</DisplayName>
    <Get assignTo="credentials.username">
        <Key>
            <Parameter>username</Parameter>
        </Key>
    </Get>
    <Get assignTo="credentials.password">
        <Key>
            <Parameter>password</Parameter>
        </Key>
    </Get>
    <Scope>apiproxy</Scope>
</KeyValueMapOperations>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BasicAuthentication name="Apigee-Basic-Authentication">
    <DisplayName>Apigee Basic Authentication</DisplayName>
    <Operation>Encode</Operation>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <User ref="credentials.username"/>
    <Password ref="credentials.username"/>
    <AssignTo>request.header.Authorization</AssignTo>
</BasicAuthentication>

i am getting below message, although username and password defined in KVM

{"fault":{"faultstring":"Unresolved variable : credentials.username","detail":{"errorcode":"steps.basicauthentication.UnresolvedVariable"}}}

Any help please

Solved Solved
0 2 764
1 ACCEPTED SOLUTION

Not applicable

In your KVM policy change the scope to environment. The error will be resolved.

current:

<Scope>apiproxy</Scope>

cheng to:

<Scope>environment</Scope>

View solution in original post

2 REPLIES 2

Not applicable

In your KVM policy change the scope to environment. The error will be resolved.

current:

<Scope>apiproxy</Scope>

cheng to:

<Scope>environment</Scope>

thanks, it worked fine after changing scope to

environment

also i changed prefix to private , since variables are encrypted