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
Common sense: Please note that you only need to run these commands on versions that are affected by OPENAM-8023.
This blog post was first published @ http://blogs.forgerock.org/petermajor/, included here with permission.