Set Authentication Type and details in pre-request-script

I would like to be able to dynamically set the Authentication Type and Details in the pre-request-script.

The two APIs I would like to connect to use either “OAuth 2.0” or “Basic Auth”.

Thank you for your time!