Joken: Using Joken.verify - trying to verify with a RS256 public key

@cs-victor-nascimento

Looks like I finally got it!

# Get our's system's token
token = URL.token(host)                                                             
                                                                                    
# Get our's system's public key
public_key = URL.public_key(host)                                                   

# Make it a Joken token                                                                                        
token = Joken.token(token)                                                          

# Verify token with public key                                                                                                                                                                               
with_signer = token |> Joken.with_signer(Joken.rs256(JOSE.JWK.from_pem(public_key)))
{:ok, claims} = with_signer |> Joken.verify!                                        
IO.puts("#{inspect claims}")                                                        

Thx for the pointers!! If there is some user oriented docs I missed reading, would love to read them!

Thx for the tool! :smile:

Quentin

2 Likes