Using external oAuth2 system

0

I'm working on a web application. This uses API's from a 3rd party system. To authenticate with the system a plain oauth2 scheme is used. A call is made to the /authorize endpoint. This redirects to a login page. Upon successful login, the user gets redirected to a URL with am authorization-code as parameter. Using this authorization-code an access token is then requests through the /tokens endpoint. This returns a simple JSON document with the bearer token (no JWT), expiry time and refresh token. Works fine.

I would now like to authenticate my own API's (API gateway REST or HTTP API's) against this 3rd party system. Would there be a way to integrate this with e.g. COGNITO is some way? Ideally Cognito should "front" this 3rd party system and just provide me app a JWT or so. Or are there solutions to authorize API gateway directly against such a 3rd party?

Thanks.

asked 4 years ago372 views
2 Answers
0

In theory, this should work out of the box as a JWT authoriser with APIGW HTTP APIs [1]. Every OAuth2/OIDC implementation has quirks, though, so interoperability isn't guaranteed. You'll need to work out the issuer endpoint for your authentication provider -- it should be the iss claim in a JWT issued by the provider.

Also, I'm pretty sure APIGW doesn't support redirecting unauthenticated requests to the authentication provider's authorisation endpoint. That might make things a bit trickier, depending on how your front-end app works.

[1] https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-jwt-authorizer.html

jamess
answered 4 years ago
0

I reworked the architecture to handle this differently.

answered 4 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