API Gateway Authorization failure for an authenticated Identity

0

Hi,

First, I am pretty new to AWS ...

I try to invoke an API in the AWS API Gateway from a Google OAuth Client App. I set up successfully an identity pool in Cognito with Google as Identity provider. This identity pool gives user access to an authenticated role by default with "AmazonAPIGatewayInvokeFullAccess" and "Cognito-authenticated" policies.

When requesting the Cognito service from my Google OAuth Client app, the "google" user of my app is identified in Cognito and I can get either a OpenId token calling "AWSCognitoIdentityService.GetOpenIdToken" or either AWS credentials calling "AWSCognitoIdentityService.GetCredentialsForIdentity"

Then, i have an Api in the API Gateway service set with the IAM Authorization mechanism.

From there, I am stuck to call my API hosted in the API Gateway service from my Google OAuth Client app or Postman : when passing the OpenId token returned by Cognito in request.headers.Authorization, i receive a 403 error {"message ": "forbidden"}.

Could someone can help me and tell me where I am wrong ?

Thanks,

Seb

1 Answer
0

Assuming you are invoking a REST API via APIGW, you may want to look at a couple of options:

  1. Lambda Authorizer
  2. Cognito User Pool Authorizer. Google can be setup as an Identity Provider for the user pool
AWS
answered 10 months ago
  • I am invoking a HTTP API via APIGW with IAM (integrated) as Authorizer.

    What is your answer about the use of an identity pool to access AWS ressources as I can get an OpenID token from it ? While I am not authorized with this OpenId token, what is its purpose then ?

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