# XState + AWS Amplify example A breakdown of a project that uses XState to manage state for authenticating a user with Cognito, and then finding the authorized application user with an invoked machine. 1. [create auth machine](#file-auth-machine-js) 2. [create auth context](#file-auth-machine-context-js) 3. [handle AWS authentication](#file-login-route-js) 4. once user authenticates with Cognito, redirect to [user route](#file-get-user-route-js) to get user from db 5. at user route use `userMachine` service from `authMachine` to get application user 6. once associated application user is found, send user to organization route to allow user to associate session with specific organization