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

openssl_pkey_export & openssl_sign problem #6

Open
AbdulHaye opened this issue Mar 20, 2018 · 2 comments
Open

openssl_pkey_export & openssl_sign problem #6

AbdulHaye opened this issue Mar 20, 2018 · 2 comments

Comments

@AbdulHaye
Copy link

I've configured config file exactly it shown in Readme.md file.

And when I use this command php ./examples/exAuthGetAccessToken.php
It gave me this error
PHP Warning: openssl_pkey_export(): cannot get key from parameter 1 in D:\htdocs\box-jwt-php\src\Auth\BoxJWTAuth.php on line 44 PHP Warning: openssl_sign(): supplied key param cannot be coerced into a private key in D:\htdocs\box-jwt-php\vendor\firebase\php-jwt\src\JWT.php on line 199 PHP Fatal error: Uncaught DomainException: OpenSSL unable to sign data in D:\htdocs\box-jwt-php\vendor\firebase\php-jwt\src\JWT.php:201 Stack trace: #0 D:\htdocs\box-jwt-php\vendor\firebase\php-jwt\src\JWT.php(170): Firebase\JWT\JWT::sign('eyJ0eXAiOiJKV1Q...', NULL, 'RS256') #1 D:\htdocs\box-jwt-php\src\Auth\BoxJWTAuth.php(71): Firebase\JWT\JWT::encode(Array, NULL, 'RS256', 'l8o5fxoo') #2 D:\htdocs\box-jwt-php\src\Auth\BoxJWTAuth.php(95): Box\Auth\BoxJWTAuth->constructJwt('23527187', 'enterprise') #3 D:\htdocs\box-jwt-php\examples\exAuthGetAccessToken.php(17): Box\Auth\BoxJWTAuth->adminToken() #4 {main} thrown in D:\htdocs\box-jwt-php\vendor\firebase\php-jwt\src\JWT.php on line 201

What I'm doing wrong?

@rlorenzo
Copy link

This is super old, but I also ran into the same issue. The fix was to copy the box.config.php file from the project root to the examples folder (update the path to the cert if needed).

I have a PR that has the example scripts use the project root config file at #21

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

3 participants