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

Custom header - invalid php-jwt code #23

Open
luxzg opened this issue Jun 19, 2020 · 0 comments
Open

Custom header - invalid php-jwt code #23

luxzg opened this issue Jun 19, 2020 · 0 comments

Comments

@luxzg
Copy link

luxzg commented Jun 19, 2020

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant