Skip to content

Can't add Mongo Storage using current driver #1071

Open
@guillemdc

Description

@guillemdc

I'm trying to connect to my mongoDB by doing this (as stated in https://bshaffer.github.io/oauth2-server-php-docs/storage/mongo/):

$mongo = new MongoDB\Client("mongodb://admin:pass@{$mongoHost}:{$mongoPort}");
$storage = new OAuth2\Storage\Mongo($mongo);

However it doesn't seem to be the right class:
Fatal error: Uncaught InvalidArgumentException: First argument to OAuth2\Storage\Mongo must be an instance of MongoDB or a configuration array in /var/www/html/vendor/bshaffer/oauth2-server-php/src/OAuth2/Storage/Mongo.php:37 Stack trace: #0 /var/www/html/public/index.php(19): OAuth2\Storage\Mongo->__construct(Object(MongoDB\Client)) #1 {main} thrown in /var/www/html/vendor/bshaffer/oauth2-server-php/src/OAuth2/Storage/Mongo.php on line 37

It seems the library is expecting the old deprecated mongo client class instead of the new recommended driver

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions