I am getting error like the below while generating JWT Token
{ "fault": { "faultstring": "Failed to Resolve Variable : policy(JWT-Generate-RS256) variable(private.privatekey)", "detail": { "errorcode": "steps.jwt.FailedToResolveVariableException" } } }
I have stored the private key in encrypted KVM and have configured the following policy to read the KVM
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <KeyValueMapOperations name="KVW-GetPrivateSecureConfig" mapIdentifier="secrets"> <Scope>environment</Scope> <ExpiryTimeInSecs>15</ExpiryTimeInSecs> <Get assignTo="private.privatekey"> <Key> <Parameter>private.privatekey</Parameter> </Key> </Get> </KeyValueMapOperations>
JWT Policy
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <GenerateJWT name="JWT-Generate-RS256"> <Algorithm>RS256</Algorithm> <PrivateKey> <Value ref="private.privatekey"/> <Id>unique-identifier-for-privatekey-here</Id> </PrivateKey> <Subject>subject-subject</Subject> <Issuer>urn://apigee-edge-JWT-policy</Issuer> <Audience>urn://c60511c0-12a2-473c-80fd-42528eb65a6a</Audience> <ExpiresIn>60m</ExpiresIn> <OutputVariable>output-jwt</OutputVariable> </GenerateJWT>
Kindly help me!!