fgtclb/typo3-oauth2-server

/oauth/token fails to load - It was not possible to parse your key

Closed this issue · 5 comments

I'm using this little app for testing:
https://github.com/lloy0076/simple-oauth2-client-example

I've created a config and configured the extension setting in TYPO3 (v9.5.20) + created keys according to the readme.md.

When trying to authenticate it get the following error:

Core: Exception handler (WEB): Uncaught TYPO3 Exception: It was not possible to parse your key, reason: error:0906D06C:PEM routines:PEM_read_bio:no start line | InvalidArgumentException thrown in file /var/www/vhosts/XXXX/deployment/production/releases/20200820134204/vendor/lcobucci/jwt/src/Signer/OpenSSL.php in line 90. Requested URL: https://www.DOMAIN.de/oauth/token

Any idea why the server can't parse the key?

Thank you :-)

Can you check if your keys start with
-----BEGIN RSA PRIVATE KEY-----
and
-----BEGIN PUBLIC KEY-----
respectively?

Yes, both keys are wrapped with -----BEGIN RSA PRIVATE KEY----- and -----BEGIN PUBLIC KEY-----
Example:

-----BEGIN RSA PRIVATE KEY-----
XXXXX
-----END RSA PRIVATE KEY-----

-----BEGIN PUBLIC KEY-----
XXXXX
-----END PUBLIC KEY-----

Its a Plesk Server in case that matters.

@ochorocho Can you ensure that only LF and not CR+LF is used as line endings in the key files?

file shows nothing, iirc it show only additional output if it is CR+LF

-bash-4.2$ file private.key 
private.key: PEM RSA private key
-bash-4.2$ file public.key 
public.key: ASCII text

Got it working. I have configured the wrong keys. So public.key was set as private key and vice versa. 🤦

Thank you for your support and sorry for the noise.