Make sure that first you add a task for an environment.
Once the task is added you can click on "Run on agent". This will open a a different view not available through oan of the tabs. Expand "Additional options" and check "Allow scripts to access OAuth token".