0

I need to do a API testing for my legacy application which is using OAuth 1.0 for authorization. Basically I will get a temporary tokens to get a access token for the API testing.

I am using JMeter 5.4.3 for the testing.

In the HTTP Header Manager, I am adding below header OAuth oauth_consumer_key="${BbTSConsumerKey}",oauth_consumer_secret="${BbTSConsumerSecret}", oauth_signature_method="HMAC-SHA1",oauth_timestamp="1654865360",oauth_nonce="5348516",oauth_version="1.0",oauth_signature="04Lp%2BF9wZjrFSCjfL%2FLdCepsUYc%3D"

But above line is not working. Getting 401 - Not Authorized error.

Please help how to make Jmeter work with OAuth v1.0.

Deena P
  • 105
  • 1
  • 2
  • 12

1 Answers1

0

I don't think you need to add the parameters to the HTTP Header Manager, my expectation is that the values should go to the HTTP Request sampler parameters

Moreover:

  • timestamp should be a number of seconds since the beginning of Unix epoch, i.e. ${__groovy((System.currentTimeMillis() / 1000) as int,)}
  • nonce should be random, i.e. ${__Random(1111111,9999999,)}
  • oauth_signature needs to be calculated, not hard-coded, the most appropriate test element I can think of is JSR223 PreProcessor

More information:

Dmitri T
  • 159,985
  • 5
  • 83
  • 133