access Cognito User Pool secured AppSync app via alternate auth mechanism

0

I have an AppSync app currently configured to use the "Amazon Cognito User Pool" Authorization Type. This works great and I love it. I'd like to make a call into that same app via GraphQL mutations using a service account of some kind (in other words, on behalf of my system rather than on behalf of a Cognito User).

Specifically I'd like to run a nightly job that issues a GraphQL query to search for certain records and then potentially execute a mutation to update some of them. This would not happen within the context of an active user session and would be "developer account" level access.

What options do I have?

질문됨 5년 전763회 조회
5개 답변
0

Hi,

Alternate auth mechanisms to the same API are not available at this time, though that is a feature request we've heard before.

This should be possible while still maintaining Cognito as the auth mechanism, though. One way to do it would be that you could create a fake user in your user pool. Using "known" credentials, you could have this user be in an admin group, then lock that operation down to this group in your GraphQL schema. Then you'd give your nightly job safe access to these credentials where it could sign in and access that set of queries/mutations.

Does that make sense?

Thanks,
Jeff

답변함 5년 전
0

Thank you. I'd love to see something more robust (ideally Cognito User Pools with the option to ALSO allow IAM user access) but this workaround is do-able. Appreciate the help!

답변함 5년 전
0

Understood - noted as a +1 to prioritizing mixed auth mechanisms for a single API. Thanks for the feedback!

답변함 5년 전
0

I'm looking for the same functionality here. I have cognito auth in my AppSync service but I want to trigger subscriptions programmatically from the back-end. It would be great to allow IAM access and Cognito at the same time. Please add +1 for me as well =)

답변함 5년 전
0

It is now possible to assign multiple authentication types. In this case, you could use both @aws_cognito_user_pools as well as @aws_iam authentication. This is now documented here: https://docs.aws.amazon.com/appsync/latest/devguide/security-authz.html

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠