laravel-mongodb icon indicating copy to clipboard operation
laravel-mongodb copied to clipboard

Does laravel-mongodb has passport support ?

Open majuansari opened this issue 6 years ago • 19 comments

I have been trying work with passport and mongodb. Do this package has passport support ? If not is any other solutions make it work with passport ?

Currently when I am running

php artisan passport:install

I am getting the following error

Encryption keys generated successfully.

In Connection.php line 451:
                                               
  Call to a member function prepare() on null  

majuansari avatar Dec 15 '17 09:12 majuansari

Hey @majuansari. Please see the implementation in this pull request https://github.com/jenssegers/laravel-mongodb/pull/1333

StevePorter92 avatar Dec 15 '17 09:12 StevePorter92

@DMNSteve Thank you. Seems like this has not been merged to the repo. Is there anyway I could use this or fix issue without editing the passport codebase ?

majuansari avatar Dec 15 '17 10:12 majuansari

You could use the fork at https://github.com/DMNSteve/laravel-mongodb.

Or you could fork the repository yourself and patch that pull request. :)

StevePorter92 avatar Dec 15 '17 13:12 StevePorter92

@DMNSteve Im using your provider + classes adapted to extend MongoDB eloquent model, from your PR but when I use the password credential type the tokens user_id is always the first use on my DB, no matter wich credentials I use on the Auth process.

public function createNewApiToken($name , $client_id , $scopes = [])
{
    $token = $this->createToken($name, $scopes);
    $token_model = Token::find($token->token->id);
    $token_model->client_id = $client_id;
    $token_model->save();
    $token->token = $token_model;
    return $token;
}

Currently added that method and accesing it to auth, as a dirty fix ¿did you have any Issue with password grant auth type ?

LeonAlvarez avatar Dec 19 '17 08:12 LeonAlvarez

I didn't have any issues myself. What version of Passport are you using? I'd like to investigate a little further.

StevePorter92 avatar Dec 19 '17 09:12 StevePorter92

@DMNSteve if anything I can help let me know

"jenssegers/mongodb": "3.3.1",
"laravel/framework": "5.5.*",
"laravel/passport": "^4.0",

LeonAlvarez avatar Dec 19 '17 10:12 LeonAlvarez

Any particular reason why your pull request is not merged ?

majuansari avatar Dec 20 '17 06:12 majuansari

Just waiting for it to be reviewed by one of the maintainers. Hopefully, it should be merged soon.

StevePorter92 avatar Dec 20 '17 09:12 StevePorter92

@LeonAlvarez, sorry for the delay. Hope you had a Merry Christmas and Happy new year!

I just had a go at this from a fresh Laravel installation and I wasn't able to reproduce the issue https://github.com/DMNSteve/1390

The only difference is that I'm using my fork at version 3.3.3 https://github.com/DMNSteve/1390/blob/master/composer.json

Might be worth having comparing some of your files with this fresh installation to see if there is anything glaringly obvious.

The user class might be a file of interest https://github.com/DMNSteve/1390/blob/master/app/User.php.

Let me know if you come across anything or would like me to have another go at reproducing

StevePorter92 avatar Jan 05 '18 16:01 StevePorter92

Happy new year! @DMNSteve I fixed it not sure where was the issue I removed depencies isntaled again and added your files and its working fine now.

LeonAlvarez avatar Jan 09 '18 11:01 LeonAlvarez

@majuansari I've closed the initial pull request and moved it to its own package available here https://github.com/StevePorter92/laravel-mongodb-passport

StevePorter92 avatar Jan 10 '18 11:01 StevePorter92

@majuansari @jenssegers A PR, with slightly different approach is added: https://github.com/jenssegers/laravel-mongodb/pull/1451

dmitov avatar Feb 27 '18 12:02 dmitov

jenssegers/laravel-mongodb not supported mongodb connection to use passport in laravel with mongodb , you install this package : https://github.com/designmynight/laravel-mongodb-passport

hosseinjafari24 avatar May 05 '18 16:05 hosseinjafari24

Hi, is there any update in this issue? It will be implemented in any near future?

esron avatar Oct 22 '19 18:10 esron

@esron, You can override main models inherited from laravel database eloquent models on jenssegers models in service provider and use them for work with passport

Smolevich avatar Oct 22 '19 18:10 Smolevich

I think if you want this feature in laravel mongodb, you can link to slack community and ask maintainer or community. Link here

Smolevich avatar Oct 22 '19 18:10 Smolevich

@Smolevich thank you for your insight. I'll try that.

esron avatar Oct 23 '19 12:10 esron

@esron did you find any solution for this?

inquisitive-stha avatar Nov 04 '19 14:11 inquisitive-stha

@inquisitive-stha for now I'm using https://github.com/designmynight/laravel-mongodb-passport.

I didn't have the time to test the models customization .

esron avatar Nov 05 '19 13:11 esron