Am getting 401 Response code while running my Jmeter script. Here is the sample result, request headers, response body, response headers.
**Sample Result:Thread Name:Thread Group 1-1 Sample Start:2022-05-04 20:13:44 IST Load time:226 Connect Time:0 Latency:226 Size in bytes:591 Sent bytes:876 Headers size in bytes:417 Body size in bytes:174 Sample Count:1 Error Count:1 Data type ("text"|"bin"|""):text Response code:401 Response message:
**Request Headers:**Connection: keep-alive Authorization: Bearer 0rPuk9bYwyE=ZXlKaGJHY2lPaUpJVXpVeE1pSjkuZXlKemRXSWlPaUpPWVhabFpXNTJaV3h3ZFhKcFFHZHZZWFZrYVhSekxtTnZiU0lzSW1saGRDSTZNVFkxTVRZMk9EZzBNQ3dpWlhod0lqb3hOalV4TnpZNE9EUXdMQ0pxZEdraU9pSmxOREF4WlRZNU1pMWxPVFJtTFRRd01XWXRPR0psTlMwMU1tRXdaR1ptTkdSaFpUVWlMQ0pwYzNNaU9pSXpOamN3TURjMVppMWpZemhpTFRRd1lURXRZakEwT1MxbE4yVXhZMlkxWW1GaFpXVWlmUS5KQjdBOUdyS1I0bWE3N1VieXcySm5xZ3RuQjJJdHR6WVVJWTBZcU13Z1Ztb3AxeXpsNkpzRHF2NDlpVHAwTHhDN1JqNXRPT1dWSnFUeWs5bW5BZTkxUQ== Referer: http://18.133.204.151/ Accept-Language: en-US,en;q=0.5 Origin: http://18.133.204.151 Content-Type: application/json Accept-Encoding: gzip, deflate User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0 Accept: application/json Content-Length: 2 Host: 18.133.204.151:8080
**Response Body:{"timestamp":"2022-05-04T14:43:44.476+0000","status":401,"error":"Unauthorized","message":"Error -> Unauthorized","path":"/webapp/api/audits/schedule/status/list"}
**Response Headers:**HTTP/1.1 401 Vary: Origin Vary: Access-Control-Request-Method Vary: Access-Control-Request-Headers Access-Control-Allow-Origin: * X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block Cache-Control: no-cache, no-store, max-age=0, must-revalidate Pragma: no-cache Expires: 0 X-Frame-Options: DENY Content-Type: application/json Transfer-Encoding: chunked Date: Wed, 04 May 2022 14:43:44 GMT
Can someone please help me in resolving the issue. I tried in many ways and nothing helping me in resolving this.
Thanks in advance.
1条答案
按热度按时间zi8p0yeb1#
根据401 Unauthorized状态代码描述:
401未授权
超文本传输协议(HTTP)401未授权响应状态代码指示客户端请求尚未完成,因为它缺少所请求资源的有效身份验证凭据。
如果记录了此Bearer token,您将无法成功重放请求,因为令牌需要关联。请查看Using Regular Expressions to Extract Tokens and Session IDs to Variables文章中的示例解决方案(您可能需要根据应用程序的具体情况进行修改)