I have integrated oauth2-proxy with AWS Cognito leveraging Istio as described in jetstack's article, all is running in K8S.
Now I am looking for an approach to get users' data and other attributes like gender
, phone_number
, or even get cognito:groups
value in my frontend app. All this info is present in a JWT payload but not on the frontend side.
Ideas:
- An API call to oauth2-proxy's
/auth2/userinfo
endpoint that returns users' email. Not much, right? - I found that Cognito's oauth2/userInfo should return much more but I don't like the idea to lock my frontend with the
aws-sdk
or have any deals with JWT on FE side. - Build a backend service that returns a JWT's payload output in custom header leveraging outputPayloadToHeader Istio's RequestAuthentication feature, like whoami does. But wait, one more microservice?
None of these seems right to me.
Is there a better approach that I should take? For example, to extend the oauth2-proxy's /auth2/userinfo
endpoint to return more than just an email
I would appreciate any help
Thanks!