Skip to content

Erlang error on invalid token with separator dots #447

@jtippett

Description

@jtippett

Expected: malformed tokens of any shape should return

iex(5)> Joken.peek_claims "invalid"
{:error, :token_malformed}

Actuality: if there's dots present, it raises:

Joken.peek_claims "invalid.jwt.token"
** (ErlangError) Erlang error: {:invalid_byte, 143}: invalid byte 16#8F at byte position 0
    (stdlib 7.2.1) json.erl:543: :json.invalid_byte/2
    (stdlib 7.2.1) json.erl:881: :json.decode/1
    (joken 2.6.2) lib/joken.ex:156: Joken.peek_claims/1
    iex:5: (file)

Fix: handle this case. Can do a PR if you like

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions