Is it safe to use a JWT as an Authorization Code?


I’m implementing an OAuth 2.0 Authorization Code grant type flow and considering to use a very short-lived JWT as the authorization code so this step doesn’t require a database.

I understand that this code is usually persisted and removed after it’s used, but are there any significant security risks of using a JWT instead?