I'm actually doing the same implementation as you, but in OCaml.
Here is some pointers to help you understand LTI protocol :
To make your own External Registration Tool (Part 4 & 6).
To know how to make OIDC Login requests
An example of OIDC login
I hope it can help you.
If you could share your code if you succeed in implementing it, I will be gratefull to you.