There is an excellent (maintained, funded, audited AND with official certification) erlang/Elixir library for that:
https://github.com/erlef/oidccI have just shipped a production service centered around OAuth and interfacing with OpenID Connect servers.