Does anybody have an example of granting cognito I...
# help
p
Does anybody have an example of granting cognito IAM auth permissions to an AppSync API? I have tried a few options and I keep getting 401s when doing queries.
a
what are trying to do? If you’re authenticating users you probably need JWT. If you’re authorising aws resources for unauthenticated users then you might need to use an identity pool in the mix. I just started exploring cognito so here’s my 2 cents.
p
I was hoping to use a cognito identity pool federated through Auth0. I'd rather use IAM internally to AWS instead of validating JWTs.
I had a JWT authorizer working, but giving IAM a go.
a
From what I’ve read and understood so far, I think IAM was not intended for authentication but for authorization. Cognito is messy lol.
p
Right, my intention is to use IAM for authorization and Auth0 for Authentication.
a
okay, so you have an identity pool configured and attached to the sst Auth construct and a user pool which federates to Auth0 via OIDC?
p
Yeah, exactly
I’m thinking my issue might be on the frontend
Not sending the correct credentials. I’m using the Amplify libraries, but I don’t see any headers with tokens being passed
a
oh, that makes sense, all authenticated requests would have an authorization header.
s
@Patrick Gold yep, I’m using AppSync in a Lambda func to make some mutations.. so it uses IAM auth. I can dig up my code examples & PM you if you’d like
p
Would be super helpful - thank you @Sam Hulick