Hi Everyone,
Hoping you might be able to help with guiding me on how to get dynamic tokens that are generated using HMAC. The API I’m busy with has been set up for testing through Postman, but I’d like to automate using RFW. Authentication consists of a Key, Secret and Auth token. The key and secret always remain the same and are set up using environment variables. There is a prerequest script at collection level that runs to generate a new token each time a call is executed. That token is then passed into an Authorization variable in the header of each request. The key, secret and token aren’t passed to the URL, so setting params or data breaks the call execution and results in 500s.
Does anyone have any suggestions please?
The code below is an adaptation of what I’ve used previously for standard JWT authentication, but when I execute now, it’s throwing a 401:
create session mysession ${BASE_URL}
${data1}= create dictionary Key=${KEY} Secret=${SECRET}
${headers}= create dictionary Content-Type=application/json
${resp}= GET On Session mysession /api/v2/Batch headers=${headers} data=${data1}
${accessToken}= evaluate $resp.json().get("token")
Log to Console ${accessToken}
${Bearer}= set variable LL
${token}= catenate LL ${accessToken}
Log to Console ${token}
Set Suite Variable ${token}