I’ve set up Firebase for frontend authentication and I am sending the ID token, which is a JWT, to my phoenix backend.
I am now stuck trying to verify the JWT.
Google instructions regarding the matter are here. TLDR: Grab the public accessible certificate and use it to verify the JWT signature was signed with the correct private key.
I have this so far
def verify(token) do
{:ok, resp} = HTTPoison.get(@cert_url)
%{body: body} = resp
body = Poison.Parser.parse!(body, %{})
{:ok, header} = Joken.peek_header(token)
cert = body[header["kid"]]
end
I’m lost there. Do I need to convert the public certificate to a public key? How do I create a Joken.Signer with RS256 signing algorithm and the public certificate?