Passport: OpenSSL problem on Windows

Created on 23 Aug 2016  路  11Comments  路  Source: laravel/passport

Hi, I found this

'openssl' is not recognized as an internal or external command, operable program or batch file.

when running

php artisan passport:install

on Windows without openssl installed.

All 11 comments

I think the better solution is using openssl_pkey_new function.

Can this, by any chance, be causing the Issue I just opened?
https://github.com/laravel/passport/issues/47

I had the same openssl problem when installing Passport, so I downloaded the zip from openssl website, then extracted (only) openssl.exe and included it in the environment path.

This made the installation work, but I'm having the mentioned issue. It's the only thing I made different from Taylor on the Laracast video, this is why I wonder if the two problems are related...

For the #47, I'll try to check it out. but, Have you tried the Git Bash to run the command?

php artisan passport:install

also, @gbdematos please make sure that ./storage/oauth-private.key and ./storage/oauth-public.key exist

@nueko tried with Git Bash, unsuccessful. I also deleted openssl.exe and tried again (because the command works on Git Bash without openssl installed), the problem persists... :(

Both oauth-private and oauth-public keys are correctly placed.

When I paste the generated Personal Token on jwt.io, even without pasting the oAuth keys to verify the signature, I see that "exp" value is 0 (zero). I think the problem is related to this... because when validating, it goes through all the values in the Token: aud, jti, iat, nbf, exp and sub... I have no idea what any of those mean, but I saw that the only "false" return is from the "exp" validation.

  1. Download GnuWin
  2. Extract bin/openssl.exe into a Environment Variable Path directory (You can create your own bin folder in your user folder or something and add that path to the Path Variable)
  3. Make a new CMD window (Existing ones will not get the newly added path)
  4. run php artisan passport:install

At some point in the new future league/oauth2-server won't require key based cryptography if you don't require it. Laravel Passport will be updated in turn to support this simpler use case.

Also installing win32/64 bin file from: https://slproweb.com/products/Win32OpenSSL.html and add to Environment Variable Path directory solve the problem.

I ended up downloading the binaries from http://gnuwin32.sourceforge.net/packages/openssl.htm and then only copied over the openssl.exe file and placed it in my php route directory which resolved the issue

FWIW I was able to solve this by using Git Bash in the directory. Oh the joys of development on windows!

Pull request that solves this here https://github.com/laravel/passport/pull/72

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SwiTool picture SwiTool  路  3Comments

rudolfdobias picture rudolfdobias  路  3Comments

duccanh0022 picture duccanh0022  路  3Comments

mehrancodes picture mehrancodes  路  3Comments

Adesubomi picture Adesubomi  路  4Comments