Skip to content

"Unexpected token algorithm" error when validating CloudFlare's JWT #13

@petersondmg

Description

@petersondmg

Hello,
I'm trying to validate Cloudflare Zero Trust JWT, but I'm getting the error "jwt: unexpected token algorithm". Looking at the code, I think the problem is related to this line the compares the header, since the JWT from CF doesn't have the "typ" field.

The line:

jwt/token.go

Line 169 in d03e03a

return Base64Encode([]byte(`{"alg":"` + alg + `","typ":"JWT"}`))

Cloudflare doc: https://developers.cloudflare.com/cloudflare-one/identity/authorization-cookie/validating-json/

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions