server_utils v0.2.4 ServerUtils.Parsers.Jwt
JWT parser to get claim values.
Link to this section Summary
Functions
Gets a claim value using the claim key from a JWT. Optional this call can fail if error_if_blank
is provided
Link to this section Functions
Link to this function
get_claim(jwt, claim_key, opts \\ [error_if_blank: false])
Gets a claim value using the claim key from a JWT. Optional this call can fail if error_if_blank
is provided.
Examples
iex> Elixir.ServerUtils.Parsers.Jwt.get_claim("example_jwt", "username")
{:ok, "luke"}
iex> Elixir.ServerUtils.Parsers.Jwt.get_claim("example_jwt", "username")
{:ok, ""}
iex> Elixir.ServerUtils.Parsers.Jwt.get_claim("example_jwt", "username", error_if_blank: true)
{:error, "Blank claim username"}