Reputation: 54
I am trying to do API Testing by JMeter in two steps:
1. Generate Acess Token
Here, the authentication request is getting timed out.
Authentication Type: OAuth2.0 Grant Type- Client Credentials
I am passing the token URL and grant_type, client_id and client_secret in the Parameters section like this:
But I am getting the following error:
2. Hit the API with the fetched token I am able to hit this with a token generated from POSTMAN. Also in POSTMAN, I am able to authenticate properly. I tried recording the POSTMAN script but the authentication flow is not getting recorded. Just the GET API is working.
Is there any way to get the token in JMeter? or any other workaround?
Upvotes: 0
Views: 1513
Reputation: 168147
Given you send the same requests you should get the same responses so capture the requests originating from JMeter and Postman using an external sniffer tool like Fiddler or Wireshark and compare the them.
The requests must be exactly the same including:
Inspect the requests and amend JMeter's configuration so the request would be 100% equal to what Postman sends.
Also it's possible to record Postman request or collection execution using JMeter's HTTP(S) Test Script Recorder
And last but not the least check HTTP Proxy settings for Postman, it might be the case you need to use a proxy server for accessing the authorization endpoint and the connection to the application under test is direct, Postman has proxy configured and JMeter doesn't, if this is the case - perform JMeter Proxy configuration again to match 100% Postman settings.
Upvotes: 1