I’m using AWS Cognito for handling user authentication. Cognito facilities authentication through an OAuth2 process. At the end of a successful OAuth authentication I end up with two tokens (access_token, refresh_tooken). These tokens allow anyone to access user information from Cognito so they need to be protected.
Ideally I would like to securely store these tokens in the DB and my question is what is the best way to encrypt columns using Ecto.
I found these references when Google searching but am not sure if these are still valid:
- GitHub - danielberkompas/cloak_ecto: Encrypted fields for Ecto
- GitHub - dwyl/phoenix-ecto-encryption-example: 🔐 A detailed example for how to encrypt data in a Phoenix (Elixir) App before inserting into a database using Ecto Types
What’s the current recommended way of securing DB columns using Ecto?























