The User type is complicated because it involves both user data stored in DynamoDB (username, image ids, # of games played), as well as a series of authentication credentials and authorization roles. These two types of data are treated separately in AWS:
We will use type User to generate the DynamoDB table and API requests (as you have already done).
We will make use of amplify add auth and the associated AuthAPIClient to actually generate Cognito credentials for the user.
Once auth credentials are established, we can then use @auth directives in our schema and know that all our GraphQL requests are properly secured via amplify (without having to do manually checks ourselves)
Progress so far:
You've already drafted a User type and generated the DynamoDB table.
You've already written a series of User based API requests via UserAPIClient.
Big Picture:
We need to generate the proper cognito credentials for a user and then maintain them to provide authorization in our app. We also need to link those credentials to the User type.
We need to link the user credentials to the User DynamoDB data.
We need to set up an S3 bucket for the userId images. This is the tricky part given AWS limitations.
Next steps:
Let's start by getting AuthAPIClient hooked up so that when you click the signup button, you not only get the User DynamoDB table created, you also get the Cognito user created. We can use central v1 as basis here:
sub mock data for actual data on sign up page and push pr.
new branch
On Sign Up, create User on the backend in DynamoDB
On the same click, call the aws sign up method linked above to create the Cognito user.
Bonus:
Take a look at the flow to confirm a user. The user will receive a code via their email and you can intake that as a prop for the confirm user function (also linked above)
The
User
type is complicated because it involves both user data stored in DynamoDB (username, image ids, # of games played), as well as a series of authentication credentials and authorization roles. These two types of data are treated separately in AWS:type User
to generate the DynamoDB table and API requests (as you have already done).amplify add auth
and the associatedAuthAPIClient
to actually generate Cognito credentials for the user.auth
credentials are established, we can then use@auth
directives in our schema and know that all our GraphQL requests are properly secured viaamplify
(without having to do manually checks ourselves)Progress so far:
User
type and generated the DynamoDB table.Big Picture:
Next steps: