-
Notifications
You must be signed in to change notification settings - Fork 825
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
aws_cognito_identity_pool_id missing in the final aws-exports.js #12520
Comments
Hi @mkbctrl 👋🏽 thanks for raising this issue. I'm transferring this to the Amplify CLI repo for better visibility. |
update: We went with manual setup today. Same issue, no identity id in the output:
|
update 2: (success) remarks:
|
Hey @mkbctrl 👋 thanks for raising this! As you have noted, when creating an auth resource we will need to select the option "connected with AWS IAM controls..." in order to provision an Identity Pool. This is also created when choosing the "default" configuration options at the beginning of the
I agree with you that this prompt flow is quite confusing, and is something that is top of mind for future iterations of the CLI! |
By default you mean default with or without the social provider? It's kind of weird if it's for bare default, cause I would assume that that's a scenario where you don't need federated sign in 🤔 ...and for the version with SP it didn't work (initial issue) unless I did smth wrong (can you have a look at the path I chose?) |
Hey @mkbctrl by "default" I am referring to the first prompt for As an example, using the "default with social provider" option will create the identity pool and associated ID in
|
Thank you @josefaidt for explaining it in detail. I have much better understanding of the overall solution right now. I followed the same flow as you "default with social provider", and it did create one user pool, and one federated identities pool. When visiting federated identities pool settings you can notice that the connection to user pool is established: but for the facebook, there is nothing. I would expect otherwise: especially that, when trying to sign in using Facebook I am getting the following error:
Not sure whether it's a bug or a feature, but as an end user I would expect it work out of the box, or get notified in the end of the process what should I do next. After entering the id manually in the federated identities pool settings, next sign in was successful. but the problem I am currently stuck with is the difference in the response shape between the regular I think I understand (thanks to: aws-amplify/amplify-js#703), that Cognito User Pool is technically speaking very similar to Federated Identities Pool, and they are entirely separate things. If I sign in with facebook, the user will be added to federated pool, and the cognito user pool won't be aware about the fact. However (I can't find the source atm), I googled, that when you connect the Cognito User Pool and Federated Identities User Pool, the federatedSignIn should return you After checking up the federated pool settings (screens above) I consider those user pools as connected. Am I wrong to assume that? The attribute mapping is set as well: Here the chunk of code handling this process (I am using next-auth to setup FB):
user:
response
So my question to you @josefaidt , can you confirm it? And if that's the case, what my current setup is missing to make it work? (The only thing added as an extra on top of default output was the FB app id) Thinking out loud:
|
Hey @mkbctrl what were the steps taken prior to noticing the Facebook credentials were missing? I was not able to reproduce that behavior when updating an existing auth resource with the social config and fake Facebook credentials However I did notice these are not also in the Identity Pool From the code snippet, are you using next-auth on top of Cognito by chance?
Do you see success from calling without passing the additional details to |
Since I was documenting the entire flow for my team all my steps were recorded. I started from scratch by running afterwards I checked if the app exist: once I was sure the project was initiated I run all the steps mentioned above, which is running the next development server locally, trying the facebook sign in by hand, running into issue that it's not supported (NotAuthorizedError mentioned above as well), fixing it by adding the FB app id to the Identity Pool, and trying again. Once I noticed I have different sets of tokens (again), and that Regarding next-auth, you are correct. I am running it on top of Cognito. Here is my next-auth configuration file:
Having Google and Facebook on top of that is currently my dream :D Edit 1:
|
Hey @mkbctrl wanted to follow up and mention that I am still investigating this use case with next-auth/auth.js on top of Cognito, but I touched base with our friends over at amplify-js and it is confirmed that when manually passing the user credentials as the second and third arguments of |
Hey @josefaidt, thanks for your effort. Do you have any news maybe? I will investigate the account linking as you suggest. Will keep you posted about any findings. |
Hey @mkbctrl apologies for the delay here! Have you found success with next-auth on Cognito? I noticed there is also now auth.js, however this would typically be used on top of a database in place of Cognito. Out of curiosity, what is the intended use case for using next-auth/auth.js on top of Cognito? Would you mind filing an issue in our docs repo requesting a guide for this with those details? https://github.com/aws-amplify/docs/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc |
Closing due to inactivity |
|
Before opening, please confirm:
App Id
NEW_APP
AWS Region
us-east-1
Amplify Hosting feature
Environment variables, Frontend builds
Describe the bug
While documenting the Cognito setup flow for my project documentation I stumbled upon an issue where using CLI for initial setup with social providers fails to include the
aws_cognito_identity_pool_id
in the finalaws-exports.js
output.Below I included the images of choices I made while settings up the environment from scratch.
Funny thing is that last week, when running the wizard, the final output did include the
aws_cognito_identity_pool_id
. I didn't document the flow that, but I am sure I was using the social provider auto setup as well, I would it expect to always include the id in the final config objectExpected behavior
Instead of
aws-exports
looking like this:it should look like (include
aws_cognito_identity_pool_id: ':Redacted',
:Reproduction steps
amplify init
amplify add auth
and afterwards running:
Build Settings
No response
Log output
Additional information
No response
The text was updated successfully, but these errors were encountered: