Coder Social home page Coder Social logo

Comments (7)

big-r81 avatar big-r81 commented on June 20, 2024

Hi,

can you paste your JWT token?

from couchdb.

rnewson avatar rnewson commented on June 20, 2024

I think it's a decode error for the public key in the config, @big-r81

we don't need the token

from couchdb.

rnewson avatar rnewson commented on June 20, 2024

we should catch and rethrow as something more presentable, but the config is wrong.

from couchdb.

rnewson avatar rnewson commented on June 20, 2024
4> public_key:pem_decode(BinPEM).
[{'SubjectPublicKeyInfo',<<48,130,2,181,48,130,1,157,2,6,
                           1,136,80,108,152,219,48,13,6,9,
                           42,134,72,134,247,13,...>>,
                         not_encrypted}]
5> [PEMEntry] =public_key:pem_decode(BinPEM).
[{'SubjectPublicKeyInfo',<<48,130,2,181,48,130,1,157,2,6,
                           1,136,80,108,152,219,48,13,6,9,
                           42,134,72,134,247,13,...>>,
                         not_encrypted}]
6> public_key:pem_entry_decode(PEMEntry).
** exception error: no match of right hand side value {error,{asn1,{{wrong_tag,{{expected,6},
                                                                                {got,2,{2,<<1,136,80,108,152,219>>}}}},
                                                                    [{'OTP-PUB-KEY',match_tags,2,
                                                                                    [{file,"OTP-PUB-KEY.erl"},{line,23999}]},
                                                                     {'OTP-PUB-KEY',decode_object_identifier,2,
                                                                                    [{file,"OTP-PUB-KEY.erl"},{line,23557}]},
                                                                     {'OTP-PUB-KEY',dec_AlgorithmIdentifier,2,
                                                                                    [{file,"OTP-PUB-KEY.erl"},{line,14558}]},
                                                                     {'OTP-PUB-KEY',dec_SubjectPublicKeyInfo,2,
                                                                                    [{file,"OTP-PUB-KEY.erl"},{line,15014}]},
                                                                     {'OTP-PUB-KEY',decode,2,
                                                                                    [{file,"OTP-PUB-KEY.erl"},{line,1232}]},
                                                                     {public_key,der_decode,2,
                                                                                 [{file,"public_key.erl"},{line,358}]},
                                                                     {public_key,pem_entry_decode,1,
                                                                                 [{file,"public_key.erl"},{line,226}]},
                                                                     {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,689}]}]}}}
     in function  public_key:der_decode/2 (public_key.erl, line 362)
     in call from public_key:pem_entry_decode/1 (public_key.erl, line 226)
7>

from couchdb.

tommyli avatar tommyli commented on June 20, 2024

OK, thanks for confirming that the key config is wrong, I worked out what happened.

I'm using Keycloak and I used the certificate instead of the public key from the realm settings. The cryptic error is probably trying to parse a public key but was given a certificate, i.e. the error {"error":"bad_request","reason":"not an RSA public key"} is a lot more meaningful as soon as I used -----BEGIN CERTIFICATE----- instead of -----BEGIN PUBLIC KEY-----.

It's working now, thanks for your help.

from couchdb.

rnewson avatar rnewson commented on June 20, 2024

:)

from couchdb.

rnewson avatar rnewson commented on June 20, 2024

yup, error handling is poor here, we'll improve it.

from couchdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.