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?
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:
URL
Request Body
HTTP Headers
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.
Related
I have a graphql server, what is working with jwt auth.
The problem: The playground sometimes sends the Authorization header, sometimes not.
Not sends: on the AWS server.
Sends: Localy.
If im hitting the aws server with postman it also works, but the dev speed would be much better with working playground.
If You checks the Network tab, the Request Header should contain the Authorization token, but the is no Authorization entry, instead the token sent in Request Payload.
You can test it out: a link
I have requirement to develop mule flow to access, login, navigate and then submit form (HTTPS Post). I am using HTTP Connector configured as HTTPS with all required configurations like host/port/path/method/TSL etc. Added Query parameters which I tracked from HTTP trace in Firefox. Also set cookies as Header but I am getting A session is required to access this resource. response instead login to application.
Please find below HTTP Connector and configuration
Any suggestion?
You should not need to set cookies explicitly, and also setting them as HTTP headers will not work. First find out the type of authentication required by the service (basic, oauth, other?), then try to configure it in the HTTP connector.
I try to login into an application that uses a login with Google Accounts. I try with the script recorder but it doesn't work.
Most probably login via Google Account is implemented using OAuth protocol and this is not something you can record and replay. Actually you don't need to load test the logging in process itself as it mostly being performed on Google side.
In order to be authenticated you need to supply correct Authorization Bearer token via JMeter's HTTP Header Manager. The token can be obtained using one of the following ways:
By recording (look for Authentication: Bearer token in the HTTP Header Manager
Using real browser from the WebDriver Sampler and once you're logged in - copy session information from browser into JMeter
From the Google Console if you have permissions
By performing full authentication process using i.e. OAuth Client Library for Java from JSR223 Sampler
See How to Run Performance Tests on OAuth Secured Apps with JMeter article for more detailed explanation on each of the approaches.
I have a request, which can be used on an endpoint with and without authentication too, but response is different in these cases. I send request to path like /MyService?wsdl. I tried to use HTTP Authorization Manager added it to HTTP Request element with whole url to this service, but it isn't working. I am sure, that username and password are correct. How is it possible to debug authentication process?
HTTP Authorisation Manager respects JMeter's Scoping Rules so make sure it is located either on the same level as HTTP Request sampler or add it as a child of this sampler (in the latter case it will be applied to this sampler only)
Configure it as follows:
Base URL: protocol followed by IP address or hostname of the application under test
Username: your username
Password: your password
Mechanism: BASIC_DIGEST
Assuming everything goes well you should see Authorization header added to your request
See How to Use HTTP Basic Authentication in JMeter article for more details.
Alternative solution is adding HTTP Header Manager and configuring it to send Authorisation header with the value of ${__base64Encode(username:password,)}
This approach assumes having __Base64Encode function installed, you can obtain it as a part of Custom JMeter Functions bundle using JMeter Plugins Manager
I suggest to use Fiddler which is a Web Debugging Proxy to send requests from JMeter through it. You can configure HTTP Request to use a proxy.
Make sure the Authorization: Basic ... header is sent within the request.
The HTTP Authorization Manager should be placed at the root of the thread group. You can then specify the full request path associated to each authorization.
I am trying to access the below URL from SoapUI which Retrieves metadata of a specific adapter.
https://www.example.com/worklightadmin/management-apis/1.0/runtimes/myruntime/adapters/myadapter?locale=de_DE
When I am accessing this URL from SoapUI. I am not sure what to give in its header and
I get
HTTP/1.1 401 Unauthorized
But when I use it in browser it asks me to login to worklightconsole so this would be granting access as a admin.
Can some one help me in understanding how to use the above URL in SoapUI and get success response.
Since you are getting 401 Unauthorized, it clearly says that you are trying to access the URL without providing any authorization information. Can you find out from SoapUI where you can provide the authorization information for the request? Basically you can select the 'Basic Auth' and provide the user name and password. For Http client like Postman there is an authorization tab, where you can select the authorization type and then username and password. It should be similar for SoapUI too