What's the best way to use OAuth to manage access to a suite of applications?

Viewed 16

Please forgive my ignorance on this topic. I've been a developer for a long time, but there's a huge gap in my knowledge and experience when it comes to authentication & authorization protocols and proper handling of tokens.

We've got a whole homegrown suite that consists of:

  • 4 web apps (2 in Ruby/Rails, 1 in Elixir/Phoenix, 1 single-page React)
  • 1 image server (serverless app written as an AWS Lambda / API Gateway)
  • 1 custom data API (also serverless Lambda / API Gateway)

We also have an Amazon Cognito User Pool connected to our backend identity provider to authenticate users and generate tokens.

All but one of these allow some form of anonymous access; the other is only available to logged in users. If a user is logged in, they all need to access the user's profile info from the ID token, preferably without initiating another auth flow. Our backend apps may also need to make use of the access token, but obviously we wouldn't be handing that out to to the SPA or public API consumers.

My first thought is to store the tokens in a key/value store on the backend, and have a short-lived, encrypted JWT containing a unique session ID set on the shared domain that all of the backend apps have access to, with the key stored in a config secret. By decoding the session ID, they can get what they need from the data store. The API would also refresh when necessary.

I also know that API Gateway can use a Cognito user pool as an authorizer, but I'm unclear how I would make that work while integrating it with the rest of our apps and requirements above. Sometimes requests to the API are made from the browser (in the React app, for example), and sometimes they come from the backend of one of the web apps.

The image server and API are used by our apps, but are also documented and accessible for other people to build their own applications on. But they would have to register their apps as OIDC clients to receive any profile info from logged in users.

I'd love some advice on how to make all of this work, or at least pointers toward resources that might help make it less dizzying.

0 Answers
Related