3

I recorded my scripts using JMeter proxy recorder. The JMeter scripts ran perfectly after I configured the Header Manager and the Authorization Manager. All the HTTP requests were responded perfectly. Only one of the HTTP request where I had performed an edit action in the application is giving unauthorized error. I am passing the token by correlation. Anybody has any suggestion on why is this happening and what is the solution?

enter image description here Here is the Sampler Result:

Thread Name: Thread Group 1-1
Sample Start: 2018-04-27 12:03:47 IST
Load time: 72
Connect Time: 1
Latency: 72
Size in bytes: 497
Sent bytes:1539
Headers size in bytes: 434
Body size in bytes: 63
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: 401
Response message: Unauthorized

Response headers:

HTTP/1.0 401 Unauthorized
Date: Fri, 27 Apr 2018 06:33:47 GMT
Server: Apache/2.4.18 (Ubuntu)
Vary: Authorization
Cache-Control: no-cache, private
Access-Control-Allow-Methods: HEAD, GET, POST, PUT, PATCH, DELETE
Access-Control-Allow-Headers: 
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Location
Content-Length: 63
Content-Type: application/json
Via: HTTP/1.1 sophos.http.proxy:3128
Connection: close

HTTPSampleResult fields:

ContentType: application/json
DataEncoding: null

**Request:** 

POST http://*********************************
POST data:
{"isDropdown":1}
[no cookies]

Request Headers:

Connection: keep-alive
Referer: http:// //Referer site//
Accept-Language: en-US,en;q=0.5
Origin: http://  //Origin site//
Content-Type: application/json;charset=utf-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 
Firefox/45.0
Accept: application/json, text/plain, */*
Authorization: Bearer //token//
Content-Length: 16
Host: *********

Response Data:

{"message":"You don't have permissions to perform this action"}
  • Your user might be not authorized for performing that action. Application just checks for your privileges (application-level privileges) and makes HTTP server respond with 401. Have you checked application logs? – Alexey R. Apr 27 '18 at 9:43
  • The user is authorized and the privilege for edit action. The edit action happens when recording the script, but it shows unauthorized action when done via JMeter. – QA9 Apr 27 '18 at 11:21
  • 3
    You should ask the developer about your problem. Since all the other requests are working fine, it must be a problem where the developer forgot to assign some privileges. Is the application under development?? This may happen when the system under test is not completely developed. Talking to your developer will be the best way for you. – Rishikesh Apr 30 '18 at 10:15
  • Your 'Authorization token' is not getting passed properly in 'Request Headers' using jmeter variable If you are extracting 'Authorization token' from any previous request or you must be sending invalid constant value as a token in 'Request Headers'. – swapnil.s May 7 '18 at 12:34
  • 1
    @swapnil.s I am already passing authorization token using Correlation. All my other request are working fine and GETting and POSTing without any error. However, just the request where I edit some data in the website, is giving unauthorized error.... – QA9 May 7 '18 at 13:53
0

Looks like a bug in the app. Ask the developer to check this request and see why you get such aresponse {"message":"You don't have permissions to perform this action"}
Also interesting

  1. Is the editing operation in JMeter happening successfully?
  2. When you do an edit operation in a browser, is the same responce coming? You can check it in the Google Deleoper Tools (Network and Console tabs).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.