How can i get 307 / 302 redirect sign In page access !

Hi I am trying to automate my entire test suite flow.

The typical flow will be once I have a service success it will redirect to sign in page and i need to access the sign in page to enter the username and password and submit to show authorisation page after submission again I have to invoke my service to get the token.

It will be like a typical OAuth 2 protocal flow, appreciate if any inputs on redirection to signin page access.

Br
N