passport: Key file permissions are not correct

I am a Windows user and use Git Bash for my development terminal. I am using PHP version 7.1.7 Default Browser is Chrome Canary or Chrome.

After installing Laravel Passport, when I run php artisan route:list I get the following error.

[ErrorException]
Key file "file://C:\Users\jschaffer\Code\passport\storage\oauth-private.key" permissions are no
t correct, should be 600 or 660 instead of 666

I understand what it is saying, but this is a windows machine and there is no concept of these types of permissions. I tried changing the NTFS permissions on the file but it doesn’t change this outputted error.

image

image

image

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

@cringer if you want to get your system back up and running modify a PassportServiceProvider.php in vendor/laravel/passport/src/ around line 192 to look like this:

/**
 * Create CryptKey instnace without permissions check
 *
 * @param string $key
 * @return \League\OAuth2\Server\CryptKey
 */
protected function makeCryptKey($key)
{
    return new CryptKey(
        'file://'.Passport::keyPath($key),
        null,
        false
    );
}

/**
 * Make the authorization service instance.
 *
 * @return \League\OAuth2\Server\AuthorizationServer
 */
public function makeAuthorizationServer()
{
    return new AuthorizationServer(
        $this->app->make(Bridge\ClientRepository::class),
        $this->app->make(Bridge\AccessTokenRepository::class),
        $this->app->make(Bridge\ScopeRepository::class),
        $this->makeCryptKey('oauth-private.key'),
        app('encrypter')->getKey()
    );
}

/**
 * Register the resource server.
 *
 * @return void
 */
protected function registerResourceServer()
{
    $this->app->singleton(ResourceServer::class, function () {
        return new ResourceServer(
            $this->app->make(Bridge\AccessTokenRepository::class),
            $this->makeCryptKey('oauth-public.key')
        );
    });
}

You will need to also add a use statement for \League\OAuth2\Server\CryptKey Passport doesn’t currently have any configuration so I didn’t make it optional. I just did this to get development back underway until this can be addressed.