Skip to content
This repository was archived by the owner on Jul 9, 2021. It is now read-only.
This repository was archived by the owner on Jul 9, 2021. It is now read-only.

Custom header - invalid php-jwt code #23

@luxzg

Description

@luxzg

When we have custom "Header" keys, the auto-generated code for firebase/php-jwt does not accomodate for it.

It should add something like:

$keyId = null;

$header = array(
    "alg" => "RS256",
    "typ" => "JWT",
    "x5t" => "somecustomstring"
);
...
$jwt = JWT::encode($payload, $privateKey, 'RS256', $keyId, $header);
...

In my case I need to add custom header with key "x5t" that contain certificate thumbprint (Microsoft/Azure token stuff)

Likewise, I don't see it specifying encoding algorithm, so it will drop to whatever is the default (HS256).

php-jwt function declaration:
public static function encode($payload, $key, $alg = 'HS256', $keyId = null, $head = null)

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