Like when you capture an oauth key, or some other 'password-like thing' that you need to store per-user and need to retrieve in plaintext so you can access an external service. Are you just putting this in a DB? AES-ing it?
My goal is to not leak oauth access when my DB inevitably gets stolen.
Good question -- not in my case, but I think yes in a lot of other token auth cases. In my case I'm storing, per-user, a secret that I need to send to a third party from time to time. The client isn't in the loop for these; they're async.
You can encrypt it in the database, but my preference is to just reset the tokens if and when the DB is stolen. If they've managed to steal it, solid chance they'll be able to decrypt it from the running db process or sniff through other infrastructure.
Like others said, try to make it's so you do not have to store anything. Otherwise, AWS has Secrets Manager for example but thatll probably be expensive for user scale in which case you can encrypt and store in DB.