The topics of this section explain how you can use JavaScript to automate retrieval of OAuth 2.0 tokens.
About
Using the Script Editor
Example
OAuth 2.0 and OAuth 2.0 (Azure)