-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get login (no social provider) working in turnkey #274
Comments
Cogito legacy prod URL Domain name: stackname to lower. Actually this should maybe be something with the User Pool ID, because otherwise the names will conflict between test and prod. This is done as of f9465f436e, using a hash of stackname plus the account number. Redirect uri as CloudFront member to Cognito via constructor. Done in dev. Client secret as env var with addEnvironment call after user pool creation in lib/MLStack.ts. Except...you can't get the client secret at CDK compile time. Maybe S3? Likewise for client id and whatever else backend needs to know about user pool Client id to front end via param store or front end deploy script can get stack output Likewise for cognito link, or construct it |
gh-274 I got an error: clientCredentials OAuth flow cannot be selected along with codeGrant or implicitGrant. I don't think I use Client Credentials when I exchange the authorization code for tokens. It doesn't look like the passover.lol User Pool has Client Credentials enabled.
gh-274 For the Cognito Hosted UI. This is so I don't get naming conflicts on the prefix between, for example, test and prod.
gh-274 The synth command revealed that the Cognito Domain had a CloudFormation Ref to the UserPool id.
gh-274 This relates to finding a name for the Cognito domain. It has to be globally unique. A recent run, which attempted to use the User Pool id (not known until deployment, complicating matters), failed with the error: The domain name contains an invalid character. Domain names can only contain lower-case letters, numbers, and hyphens. Please enter a different name that follows this format: ^[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?$ Looks like we get about 62 characters for the domain prefix, so I might want to add a fixed-size hashing feature to @cdk-turnkey/stackname to ensure we stay in that limit.
gh-274 This issue has some discussion of why I want this, and why hashing is a nice technique for naming AWS resources like the Cognito User Pool domain name prefix: cdk-turnkey/stackname#1.
gh-274 This is based on the workaround for the exact problem described here: aws/aws-cdk#10062 Basically I got the error "User pool already has a domain configured." when I tried to rename the User Pool Domain. So here I'm deleting the user pool domain so I can re-deploy it with a new name. It's the workaround described as a "2-stage deploy" in the issue comments.
gh-274 This is to complete the 2-step deploy described here: aws/aws-cdk#10062 (comment) I'm renaming the Cognito User Pool Domain with a fixed-size string with acceptable letters for a Domain prefix, and that varies based on the repo namespace, repo name, branch, and account.
gh-274 This is step towards saving the client secret somewhere that the backend can get it after deployment.
gh-274 This tries to validate the syntax for saving the user pool client secret to S3, where backend will be able to find it. It saves non-secret data from the Cognito user pool client, but if the data winds up in the bucket without being printed in Actions, I'll change it so that it saves the actual secret.
douglasnaphas/madliberation#274 This is a first step towards making the Cognito domain vary correctly by environment.
gh-274 This should fail, as the required env var is not set.
douglasnaphas/madliberation#274 This is the only way I could find for frontend to make sure that it has the link to its Cognito User Pool domain.
douglasnaphas/madliberation#274 It will vary by env.
douglasnaphas/madliberation#274 The backend will next need to return from /prod/login with a redirect to the Cognito hosted UI URL.
douglasnaphas/madliberation#274 This needs to turn in to determining and sending back via Location the Cognito Hosted UI URL.
gh-274 This was part of a currently unfavored effort to communicate the Cognito hosted UI URL to the frontend by injecting an environment variable at build time. I am going to pursue instead the strategy of having the Log In link on the home page link to /prod/login, and having backend's /prod/login return a redirect to the Cognito hosted UI URL. I'm committing scripts/build-frontend.sh, which will not be used in the preferred setup, so I have a record of it.
gh-274 See the previous commit message, the one where I added the file I'm removing here, for rationale. This is part of an attempt to make it so that I don't have to build the frontend static files for each env.
gh-274 I don't have an API for this app, I have a backend. Nobody but my frontend calls it.
gh-274 Note the env-specific Actions steps as being for the dev env.
douglasnaphas/madliberation#274 This sets up the integration test to create a user (in setup, via the SDK), then log in as the user. This validates that the user pool is usable. The last implemented piece is trying to join the seder as Player 2. This should fail, because /get-cookies is not set up under turnkey yet.
gh-274 See the commit message for the itest commits brought in here. This expands the itest script to log in and change the password for Player 2. It should fail when it tries to join the seder, because that is not yet implemented under turnkey.
gh-274 This is so the backend can run in multiple environments (accounts, Git branches).
gh-274 Taken from the workaround in the issue description here: aws/aws-cdk#7112. My error noted here: aws/aws-cdk#7112 (comment)
Users should be able to sign up with just a Mad Liberation username/password, but they should be prompted for an email on signup. I need to check and see what user info is available in different scenarios (social login, no email provided, etc), because the frontend needs to say "Logged in as X." |
gh-274 Temporarily comment-out the itest step against the test env. This allows test-breaking changes to flow through to prod, deleting the user pool so it can be re-created with changes to attributes.
douglasnaphas/madliberation#274 Everything (frontend and backend) runs behind the same host in the Turnkey setup, thanks to CloudFront.
douglasnaphas/madliberation#274 It needs to be relative to the base location /prod/.
douglasnaphas/madliberation#274 Nickname is required now, because the frontend needs it so it can say "Logged in as <NICKNAME>."
TODO
mljsapi
... Deferring, going to try with S3Add a prettier config to package.json at the madliberation level. Read through the options and figure out which I want.Issue Harmonize prettier settings #277 created for this.Save/retrieve the Cognito domain with SSM param store.Deferring, not sure if this would work given the build steps.Make frontend/ require an env var for the build to happen, via checking in a build script.This might need to be reconsidered, since I'm not sure ifREACT_APP_
vars are read at build or run time. Update: they're read at build time, so they go into the bundle. Still not sure if this is the right approach, as opposed to receiving a redirect from a backend endpoint.backend
app.test.js
testing thatapp
returns 301 from /login, using Jest.process.env
accesses there.The text was updated successfully, but these errors were encountered: