Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid issuer with no option for this #46

Open
Ludea opened this issue Apr 27, 2019 · 1 comment
Open

Invalid issuer with no option for this #46

Ludea opened this issue Apr 27, 2019 · 1 comment

Comments

@Ludea
Copy link

Ludea commented Apr 27, 2019

Hello,

I try to decode and verify a remote jwt.
I check error value, and get a InvalidIssuer
And I get {"alg":"none","typ":"JWT"} null
Here my code

void api::verify_token(std::string token)
{
        jwt::string_view encoded_token = token ;
        auto decoded_token = jwt::decode(encoded_token, algorithms({"hs256"}), ec, secret(key), verify(true));
        switch(ec.value())
        {
        case static_cast<int>(jwt::VerificationErrc::InvalidAlgorithm):
                std::cout<<"error"<<std::endl;
        break;
        case static_cast<int>(jwt::VerificationErrc::TokenExpired):
                std::cout<<"error1"<<std::endl;
        break;
        case static_cast<int>(jwt::VerificationErrc::InvalidIssuer):
                std::cout<<"error2"<<std::endl;
        break;
        case static_cast<int>(jwt::VerificationErrc::InvalidSubject):
                std::cout<<"error3"<<std::endl;
        break;
        case static_cast<int>(jwt::VerificationErrc::InvalidIAT):
                std::cout<<"error4"<<std::endl;
        break;
        case static_cast<int>(jwt::VerificationErrc::InvalidJTI):
                std::cout<<"error5"<<std::endl;
        break;
        case static_cast<int>(jwt::VerificationErrc::InvalidAudience):
                std::cout<<"error6"<<std::endl;
        break;
        case static_cast<int>(jwt::VerificationErrc::ImmatureSignature):
                std::cout<<"error7"<<std::endl;
        break;
        case static_cast<int>(jwt::VerificationErrc::InvalidSignature):
                std::cout<<"error8"<<std::endl;
        break;
        case static_cast<int>(jwt::VerificationErrc::TypeConversionError):
                std::cout<<"error9"<<std::endl;
        break;
//      default:
        }
        std::cout << token <<std::endl;
        std::cout << decoded_token.header() << std::endl;
        std::cout << decoded_token.payload() << std::endl;

}

If I try to decode my jwt from jwt.io, there is no issue, with no issuer field

@arun11299
Copy link
Owner

arun11299 commented Apr 29, 2019

Hi @Ludea
Would you be able to provide me the token and the key to reproduce the issue ?
Please feel free to mail me ([email protected]) if it is something you cannot share on github but can share it privately.

Thanks!

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

No branches or pull requests

2 participants