I am using the AWS Amplify to create a website platform that functions mostly as a directory of its registered users with various attributes relating to the business domain. The two primary users for the platform will be registered users and normal unauthenticated users who will be able to list and filter the registered users based on their attributes such as location
, age
, etc. Registered users will be set all their attributes in the members area.
Some of the attributes are stored in Cognito such as name
and address
and were setup using Amplify Authentication. These are fields I would like to be to query and mutate through the Amplify GraphQL capabilities.
I can see there are cool authorization patterns that can be achieved with the @auth
directive.
Is it possible to leverage GraphQL Transform such that I can create a model schema where some of the fields link to the Cognito User Pool and some are defined within the GraphQL schema so that they are queryable and mutable? In fact I would like to provide registered users with the facility to update all their fields except email. Or maybe there is some combination of services supported by Amplify that I can hook up together to achieve the same?
I am new to the AWS Serveless ecosystem and it has been exciting so far!
I found out the above can be achieved using the @function
directive. It allows us to connect lambda resolvers to the schema. In the lambda we can do virtually anything like read and update Amazon Cognito User Pools.
https://aws-amplify.github.io/docs/cli-toolchain/graphql#function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With