One of the unfortunate issues with OpenAM 13 is that there is a performance problem when performing OAuth2 operations, more namely: OPENAM-8023. Whilst the underlying root cause appears to be a rather complex problem deep in the SMS framework, there is a quite simple, but very effective way to work around this issue.
You’ll need to run the following ssoadm commands for all the realms (where you are using OAuth2):
$ openam/bin/ssoadm add-svc-realm -e -s ScriptingService -u amadmin -f .pass -D file $ openam/bin/ssoadm create-sub-cfg -s ScriptingService -g scriptConfigurations -u amadmin -f .pass -D file -e
UPDATE!: I forgot to detail a very important thing: what the input file contains for these commands… The answer is: absolutely nothing. They need to be completely empty files (use “touch file” for example).
Common sense: Please note that you only need to run these commands on versions that are affected by OPENAM-8023.