AutoUser
AutoUser

Reputation: 1

\api\data\v9.0 is failing with error 401 unauthorized in Jmeter

Thread Name:Thread Group 1-1 Sample Start:2022-11-14 15:38:43 GMT Load time:56 Connect Time:42 Latency:56 Size in bytes:1472 Sent bytes:2669 Headers size in bytes:1472 Body size in bytes:0 Sample Count:1 Error Count:1 Data type ("text"|"bin"|""): Response code:401 Response message:Unauthorized

HTTPSampleResult fields: ContentType: DataEncoding: null

Response Header Connection: keep-alive Sec-Fetch-Mode: cors Sec-Fetch-Site: same-origin Accept-Language: en-GB,en;q=0.5 prefer: odata.include-annotations="*" x-ms-sw-tenantid: x-ms-user-agent: clienthost: Browser x-ms-client-session-id: Accept: application/json x-ms-source-id: x-ms-sw-objectid: x-ms-correlation-id: content-type: application/json x-ms-app-id:

I tried applying Cookie Manager and Authorization Manager but the code is failing everytime.

Upvotes: 0

Views: 333

Answers (1)

Dmitri T
Dmitri T

Reputation: 168157

As per HTTP Status Code 401 description:

The HyperText Transfer Protocol (HTTP) 401 Unauthorized response status code indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource.

This status code is sent with an HTTP WWW-Authenticate response header that contains information on how the client can request for the resource again after prompting the user for authentication credentials.

So you either need to provide proper Authorization header via HTTP Header Manager or again properly configure the HTTP Authorization Manager to generate the header for you.

Upvotes: 0

Related Questions