You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to use Saucelabs for our API automation along with our UI automation. But our APIs require HmacSHA1 authentication. We need to generate this using resource path, request method and time stamp. As far as I know, right now Saucelabs doesn't give an option to execute a pre-requisite script to generate such token. There is the option of hmacSha1(input : String, secret : String) : String but without having the option of Date in UTCString and resource path variable, it is not possible to use this.
Motivation
We are already using Saucelabs for our Mobile testing. Wanted to use it for our API testing as well.
Example
This is how we use it in Postman. Looking for a similar capability in Saucelabs.
var access_id = "access_id";
var secret_key = "secret_key";
const path = pm.variables.replaceIn(pm.request.url.getPathWithQuery());
var mydate = new Date();
var dateString = mydate.toUTCString();
var canon = [request.method, 'application/json', '', path,dateString].join(',');
var hash = CryptoJS.HmacSHA1(canon, secret_key);
token = hash.toString(CryptoJS.enc.Base64);
var authHeader = "APIAuth " + access_id + ":" + token;
pm.collectionVariables.set('dateHeader', mydate.toUTCString());
pm.collectionVariables.set('apiauth', authHeader);
The text was updated successfully, but these errors were encountered:
🚀 Feature Proposal
Have you read the contributing guidelines on issues?
Description
We are trying to use Saucelabs for our API automation along with our UI automation. But our APIs require HmacSHA1 authentication. We need to generate this using resource path, request method and time stamp. As far as I know, right now Saucelabs doesn't give an option to execute a pre-requisite script to generate such token. There is the option of hmacSha1(input : String, secret : String) : String but without having the option of Date in UTCString and resource path variable, it is not possible to use this.
Motivation
We are already using Saucelabs for our Mobile testing. Wanted to use it for our API testing as well.
Example
This is how we use it in Postman. Looking for a similar capability in Saucelabs.
var access_id = "access_id";
var secret_key = "secret_key";
const path = pm.variables.replaceIn(pm.request.url.getPathWithQuery());
var mydate = new Date();
var dateString = mydate.toUTCString();
var canon = [request.method, 'application/json', '', path,dateString].join(',');
var hash = CryptoJS.HmacSHA1(canon, secret_key);
token = hash.toString(CryptoJS.enc.Base64);
var authHeader = "APIAuth " + access_id + ":" + token;
pm.collectionVariables.set('dateHeader', mydate.toUTCString());
pm.collectionVariables.set('apiauth', authHeader);
The text was updated successfully, but these errors were encountered: