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?

asked 5 years ago747 views
5 Answers
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

answered 5 years ago
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!

answered 5 years ago
0

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

answered 5 years ago
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 =)

answered 5 years ago
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

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions