Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Hard code user credentials before calling the target endpoint

Hello All,

I am new to apigee, please pardon my ignorance My target endpoint requires username/password, so I wanted to hardcode the credentials, for this I created first a "KVM" .. Then I created the "Basic Authentication policy.. But when I use it I get following error

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

Following is my KVM

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="CreateCRAuthMap">
    <DisplayName>CreateCRAuthMap</DisplayName>
    <Properties/>
    <ExpiryTimeInSecs>86400</ExpiryTimeInSecs>
    <Put>
        <Key>
            <Parameter>cr_username</Parameter>
        </Key>
        <Value>content-repo-reader</Value>
    </Put>
    <Put>
        <Key>
            <Parameter>cr_password</Parameter>
        </Key>
        <Value>XXXXXXX</Value>
    </Put>
    <Scope>environment</Scope>
</KeyValueMapOperations>

Following is my auth policy

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BasicAuthentication async="false" continueOnError="false" enabled="true" name="Basic-Authentication-1">
    <DisplayName>CR Authentication</DisplayName>
    <Operation>Encode</Operation>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <User ref="CRAuthMap.cr.username"/>
    <Password ref="CRAuthMap.cr.password"/>
    <AssignTo createNew="false">request.header.Authorization</AssignTo>
    <Source>request.header.Authorization</Source>
</BasicAuthentication>

Did i get this all wrong ..
Solved Solved
0 4 1,118
1 ACCEPTED SOLUTION

HI @Ravindra Mamidipaka

Welcome to the community !!

There was a similar post - please refer to this answer and let us know if you are still stuck

View solution in original post

4 REPLIES 4