bshaffer / oauth2-server-php

A library for implementing an OAuth2 Server in php
http://bshaffer.github.io/oauth2-server-php-docs
MIT License
3.26k stars 950 forks source link

Can't add Mongo Storage using current driver #1071

Open guillemdc opened 2 weeks ago

guillemdc commented 2 weeks ago

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