How to get access token dynamically using code

Hi, Am doing API Testing, using Outh2 authorization, my company using identity service which doesnt have any API who can give me access token.

How can I get access token using the groovy script.

any suggestion?

The authorization code grant is used when an application exchanges an authorization code for an access token. After the user returns to the application via the redirect URL, the application will get the authorization code from the URL and use it to request an access token.

Many thanks… Let me ask bit in detail my question:
It is very simple question, Right now i am using Postman and getting the token manually

I want to use Katalon OAuth2 functionality and generate token via code.

any suggestion