Not sure if this topic is already posted. It was hard to find the scenario what I am looking for, hence posting as a new topic.
We have many APIs which have different behavior for different roles set for the user. If I want to test these APIs for different user roles, I need to change the user credentials and verify the behavior. My questions are :
- How to I automate generation of OAuth2.0 token using user login details. I want to use the Collection Runner to run my tests, hence no manual intervention to enter user login details is expected in the flow.
- For one of the client, we have the grantType as ClientCredentials and I can automate without manual intervention to generate the OAuth2.0 token using the clientId/clientSecret and use it in all my scripts by setting the token in a global variable. For another client, we have grantType as Code and when I use this client in postman Authorization , it takes me to user credentials screen to enter my login details. This is the flow , I am looking to automate so that I can generate token for different user roles and run my tests appropriately.
Any help is much appreciated.
Thanks,
Sahana