Hey!
I think you should write a plugin.
Use https://github.com/julianlam/nodebb-plugin-sso-oauth as a template.
And this - https://www.npmjs.com/package/passport-cognito is a package you can use in your plugin.
You can also take a look at Google SSO - https://github.com/julianlam/nodebb-plugin-sso-google (as an example)