Skip to content
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

Issue Title: Unable to Change Authorization Type for API to Cognito User Pools in Amplify #13947

Closed
2 tasks done
stephenjen opened this issue Sep 28, 2024 · 3 comments
Closed
2 tasks done
Labels
api-rest Issues tied to REST APIs pending-response Issue is pending response from the issue author pending-triage Issue is pending triage

Comments

@stephenjen
Copy link

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

v17.5.0

Amplify CLI Version

12.12.6

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

After using Amplify add api to create the api gateway for my Lamda function, I changed the authorization for the API gateway for the state to Cognito pool, then deployed the change.

Describe the bug

I used Amplify add api to create the API gateway for my Lamda function. During this process, I selected Restrict API access to Y for Authenticated users only. Despite this, the authorizationType in amplifyconfiguration.dart shows "authorizationType": "AWS_IAM".

I then changed the authorization for the API gateway via AWS Console for the state to Cognito pool, then deployed the change. But amplifyconfiguration.dart still shows "authorizationType": "AWS_IAM".

I ran amplify pull --restore, but the amplifyconfiguration.dart still shows AWS_IAM as the authorization type.

Additionally, my parameters.json file located in amplify/backend/api/<my_api_name>/build/ is empty ({}), and the correct parameters.json file does not exist in the amplify/backend/api/<my_api_name>/ directory.

Expected behavior

API gateway to use congito user pool to authenticate API calls

Reproduction steps

  1. Create and test Lamda function
  2. Run Amplify api add to add the REST api for the Lamda function
  3. Run Amplify push to push changes to AWS
  4. Noticed amplifyconfiguration has AWS_AMI as authorizationType

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@stephenjen stephenjen added the pending-triage Issue is pending triage label Sep 28, 2024
@ykethan
Copy link
Member

ykethan commented Sep 30, 2024

Hey @stephenjen, thank you for reaching out. To modify the authorizer on the REST API, you would need to override the resource. Refer to AWS Amplify documentation on authorizing API requests with Cognito User Pools.

@ykethan ykethan added api-rest Issues tied to REST APIs pending-response Issue is pending response from the issue author labels Sep 30, 2024
@ykethan
Copy link
Member

ykethan commented Oct 21, 2024

Closing the issue due to inactivity. Do reach out to us if you are still experiencing this issue

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2024
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-rest Issues tied to REST APIs pending-response Issue is pending response from the issue author pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

2 participants