This is a serverless sample code which will use KeyCloak as SSO solution. By passing username and password it will return you with a token along with the possible claims.
Feel free to clone and tweak.
This sample code will deploy a aws lambda and setup a Api Gateway as well!