-
Notifications
You must be signed in to change notification settings - Fork 75
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
Support different authentication types for a REST API #438
Comments
@kstro21 The API Gateway service doesn't have API Keys as one of their authentication methods I beleive. As a part of the CLI we support Cognito for auth/unauth access which you could probably use. |
@kaustavghosh06 thanks for the response. I'm currently using Cognito for auth/unauth and it works OK, but I'm trying to switch to API Keys and Usage Plans as described here https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-usage-plans.html Here is an example that describes the process using de AWS API Gateway console https://medium.com/@zeebaig/protect-aws-api-gateway-endpoints-using-api-keys-5d8c066c5a5d If it can be configured using the console, it can be configured using CloudFormation too, right? |
+1 for this feature! It would be really nice to have different authentication methods for a REST API |
This is an awesome project and I was wondering as to why the CLI doesn't support adding API keys as auth type for REST APIs? |
+1 |
So I have found that you cannot do this via the amplify-cli. However for anyone searching for a way to do this and not have amplify blow out your api-key on every deploy I have this solution. You need to modify the file In the section labeled
Note if you are doing other auth methods in addition to api-key you will need to add the api_key to the security section that is already there.
Additionally, you need to add the
Larger Example:
I hope this helps some people. |
@egreenmachine thanks for sharing. ^ This works! |
This solution is not working in the latest amplify version. Since now there is only Is there any way we can do it in amplify version after 7 ? |
yea, I am wondering about the same thing as @iOrcohen. :/ |
Same here. Can anyone point us in the right direction? Thanks! |
I need this also... |
I just open aws-amplify/amplify-cli#10085, where I'm trying to override security for methods, something similar to @egreenmachine suggests |
I am also trying to get an API Key and Usage Plan working. And I'd like the API key to be required as the rest apis are not otherwise authenticated. |
I have been able to configure usage of API Key Auth on specific endpoints, though still exploring how to configure UsagePlans. You can add
Hope this helps |
So, I have used
amplify api add
and now have GraphQL and REST API in my project, but the auth for my REST API is using Cognito. How can I change that? I would like to use API Key authentication for my REST API and keep using Cognito for the rest. I can not find any reference in the doc and by runningamplify auth add
again I get the message:If this is currently not supported going through some
amplify-cli
command or by editing some CloudFormation template, then it can be a candidate for a feature request.The text was updated successfully, but these errors were encountered: