How to capture and store grant meta--data

We need to store meta-data including timestamp each time a user grants permission to an app through the Authorization Resource Code Grant. It looks like a Rule is the best way to capture this, but there is no grant metadata so we will need to store it externally or possibly in the user metadata. The context does not have the grant id, so how would we cross-reference the information?

This must be a common use case especially for the grant timestamp. What is the best practice for doing this?