Skip to content

Add a way to get the JWT header as well as the payload from ::decode() #431

Closed
@pwolanin

Description

@pwolanin

In some cases it would be nice to have easy access to the values in the JWT header. Especially the Key ID, but also the algorithm if more than one was allowed.

Currently, one has to extract the header and decode it again.

Options for this would include a new version of decode() (naming is hard... like decodeWithHeader() maybe) that would return both the payload and the header in an array or object. The current decode() method could stay the same for BC and return the payload part of the compound result.

Another option could be to add another, optional method parameter passed-by-reference that would be populated with the header.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions