Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Can't add Mongo Storage using current driver #1071

Open
guillemdc opened this issue Nov 7, 2024 · 0 comments
Open

Can't add Mongo Storage using current driver #1071

guillemdc opened this issue Nov 7, 2024 · 0 comments

Comments

@guillemdc
Copy link

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant