Automation of OAUTH2.0 token

Hi , I am looking for an assistance in writing automation pre requisite scripts for getting an OAUTH2.0 instead of manually clicking the “Get New Access token” and getting the token via browser.I need to login to the Auth URL and provide consent for the consent created by accepting it and then it will redirect to postman via callbackURL where I will store the token generated in an environment variable. Is there any way to automate the whole process. This is a middle step when I am running the collection and this stops me from running the collection as a whole. So, your help will be much appreciated. Thanks in advance.

You cannot automate the OAuth grants that require browser interaction.

Which is one of the benefits of the Authorization helper.

If you want to automate the authentication, then you will need to see if you can change the authentication to something else like Client Credentials or Password.

I don’t know your setup or test scenarios but in our organization I’m not generally bothered about the authorization process, but about the application that I land on after authentication. We have manual tests for testing the end to end authentication, so for our automated tests, client credentials is fine, or we set it up with password if I have to test multiple roles/access rights.

If you use Microsoft for authentication, you can setup the app registration to support multiple grant types for your test environments, but limit it in PROD.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.